Jspdf: Should have a customizabe build

Created on 29 Mar 2019  路  5Comments  路  Source: MrRio/jsPDF

Usecase

When integrating JSPdf in other projects, not all features will be necessary. The required feature set depends on the application and on the platform (browser, cli)

Request

  • [ ] There should be an interactive feature builder which allows to select the intended Features. An initial version of this is already there as builder.html
  • [ ] the feature Bulider shall be able to save the feature selection file which can subsequently be used to be version controlled, used in a build pipline etc.
  • [ ] the feature Builder shall be able to load the feature selection file as a baseline for an updated configuration.
  • [ ] The feature builder shall load the configuration of available features from a configuration file which might also be used by the custom_builder
  • [ ] There shall be a custom_builder which takes the aforehead mentioned feature selection file and generates a JSPdf.{featureset}.debug.js
  • [ ] the generated JSPdf.{featureset}.debug.js shall contain the selected features as comment (maybe even retrievable via the api by JSPdf clients)
  • [ ] the generated JSPdf shall contain version number and git SHA for reference purposes

Solution approach

  • [ ] jspdf.features.js - this is a json file which contains the available features and the dependant modules.
  • [ ] builder.html - this is the editor for the feature selection based on jspdf.features.js. builder.html can upload/download the feature selection file as well as the result of a build (which is a shortcut ...)
  • [ ] custom_builder.js this script builds a jspdf.{featureset}.debug.js where featureset is the basename of the featureselection file.
  • [ ] feature selection file: this file is maintained by builder.html. It takes all the information provided by the user. The feature selection file is intended to be kept in the vcl of integrator projects.
Feature Request no-issue-activity

Most helpful comment

Wouldn't an easier approach be supporting tree shaking? Ie letting module bundlers take the code that is used and remove everything else. Related to this #839

All 5 comments

Wouldn't an easier approach be supporting tree shaking? Ie letting module bundlers take the code that is used and remove everything else. Related to this #839

@simonbengtsson
The builder i made was just made as a gimmick. Not really for productive use, but more like a test which parts are maybe depending on each other.

So I will maybe remove the cli.js and other non working builder parts or hide for now, as maybe people will complain that it wont work etc. ;)

Tbh I think jsPDF will be longer a monolith.

There are different requirements depending on the use case that we should have a customizable build providing a monolithic, easy to integrate jspdf. Therefore something like build.cli will be necessary.

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

Kind of a duplicate of #839.

Was this page helpful?
0 / 5 - 0 ratings