-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add include and exclude options to explicitly control compiled features
This adds `include` and `exclude` options, which allow you to explicitly turn on or off certain features. These override the defaults based on the provided browser targets. For example, you might want to only compile colors, and handle auto prefixing or other features with another tool. Or you may want to handle everything except vendor prefixing with Lightning CSS. These options make that possible. An enum of available feature flags is provided, and you can use the bitwise OR operator to combine flags together, e.g. `Features.Nesting | Features.Colors`. There are also some flags with turn on multiple flags at once, e.g. `Selectors`, `Colors`, and `MediaQueries`. The playground has been updated to show these flags and includes checkboxes to turn them on or off. The Rust API has been updated to accept a new `Targets` struct instead of `Browsers`. This includes browser targets as a sub-field, along with the include and exclude options. Internally, the code has actually been simplified due to some new helper methods on the Targets struct which determine whether to compile certain features, and which vendor prefixes to include. This gets rid of a lot of option unwrapping throughout the code.
- Loading branch information
1 parent
c34af42
commit 09f6b7a
Showing
65 changed files
with
1,218 additions
and
1,179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// This file is autogenerated by build-prefixes.js. DO NOT EDIT! | ||
|
||
exports.Features = { | ||
Nesting: 1, | ||
NotSelectorList: 2, | ||
DirSelector: 4, | ||
LangSelectorList: 8, | ||
IsSelector: 16, | ||
TextDecorationThicknessPercent: 32, | ||
MediaIntervalSyntax: 64, | ||
MediaRangeSyntax: 128, | ||
CustomMediaQueries: 256, | ||
ClampFunction: 512, | ||
ColorFunction: 1024, | ||
OklabColors: 2048, | ||
LabColors: 4096, | ||
P3Colors: 8192, | ||
HexAlphaColors: 16384, | ||
SpaceSeparatedColorNotation: 32768, | ||
FontFamilySystemUi: 65536, | ||
DoublePositionGradients: 131072, | ||
VendorPrefixes: 262144, | ||
LogicalProperties: 524288, | ||
Selectors: 31, | ||
MediaQueries: 448, | ||
Colors: 64512, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import index from './index.js'; | ||
|
||
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors } = index; | ||
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors }; | ||
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = index; | ||
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.