Closed kitsonk closed 7 years ago
Two thoughts on this...
-t
and --target
. I am not sure which makes overall better sense. Or even something else?.dojorc
to specify custom features which will be mixed in to any other targets makes the most sense.This now requires dojo/shim#101 for the sets of features to actually be effective.
Type: feature
The following has been addressed in the PR:
Description:
This PR allows build optimization using the
has
feature detection library. During the build process, any static features that have been asserted are used to replace call expressions that look something likehas('feature')
. For example, if featurefoo
was set totrue
as a static flag, this code:Would be transformed to this:
Then further during the build process, if the build is being minified, uglify will detect the dead code and rewrite it further to something like:
At the command line, users are abstracted from individual flags, and instead supply a set of feature flags they wish to use. The supported sets are located in
src/features/*.json
. These are specified by the user by setting the-f
or--feature
flag on the CLI. Multiple feature sets are combined to produce the largest set where the values do not conflict. For examplees6-promise
istrue
onchrome
butfalse
onie11
. Ifchrome
andie11
were specified, the values would conflict and this feature would not be statically bound.A user supplying multiple platforms would look something like this:
Which would produce a build that is statically built with features that are common between Chrome, Safari, Firefox.
At the moment, most of the shim library isn't written to have polyfill code within
has()
guard blocks, therefore it doesn't get removed from the build when the native feature is statically expressed. We will need to revisit those modules in order to create something that builds optimally.Todo:
Resolves #142