frets-styles-generator
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -22,2 +22,4 @@ #! /usr/bin/env node | ||
.option("-t, --template <path>", "specify a custom template file [path to a js module]") | ||
.option("-p, --purge", `Allow purgecss in your custom postcss.config.js to purge the output files. | ||
Default is to skip purgecss plugin if it's in your project postcss.config`, false) | ||
.parse(process.argv); | ||
@@ -51,13 +53,15 @@ const inputPath = normalize(program.args[0] || "./src"); | ||
customPlugins = require(postCssConfigPath).plugins; | ||
if (customPlugins) { | ||
if (customPlugins["import"]) { | ||
delete customPlugins["import"]; | ||
const removeThesePlugins = ["postcss-import"]; | ||
if (!program.purge) { | ||
// we don't want purge to run by default | ||
removeThesePlugins.push("postcss-plugin-purgecss"); | ||
} | ||
customPlugins = customPlugins.filter((p) => { | ||
if (p && p.postcssPlugin && removeThesePlugins.includes(p.postcssPlugin)) { | ||
console.log("removing ", p.postcssPlugin); | ||
return false; | ||
} | ||
if (customPlugins["atImport"]) { | ||
delete customPlugins["atImport"]; | ||
} | ||
if (customPlugins["importer"]) { | ||
delete customPlugins["importer"]; | ||
} | ||
} | ||
return true; | ||
}); | ||
// console.log(customPlugins); | ||
function readFile(input, output) { | ||
@@ -81,3 +85,3 @@ console.log("reading " + input); | ||
// console.log("Using Config: ", opts); | ||
postcss([...customPlugins, importer({ root: inputPath })]) | ||
postcss([importer({ root: inputPath }), ...customPlugins]) | ||
.process(data.toString(), { | ||
@@ -138,2 +142,2 @@ from: inputPath, | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVpbGQtc3R5bGUtdHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9idWlsZC1zdHlsZS10eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUtBLHlCQUF5QjtBQUN6QixtQ0FBbUM7QUFFbkMsTUFBTSxRQUFRLEdBQUcsT0FBTyxDQUFDL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QUFnQztZQUNoQyxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVcsZUFBZSxDQUFDLE1BQU0saUJBQWlCLE1BQU0sRUFBRSxDQUFDLENBQUM7WUFDeEUsRUFBRSxDQUFDLGFBQWEsQ0FBQyxNQUFNLEVBQUUsZUFBZSxDQUFDLENBQUM7WUFDMUMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7Z0JBQ3RCLEVBQUUsQ0FBQyxhQUFhLENBQUMsS0FBSyxFQUFFLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztZQUN0QyxDQUFDO1lBQ0QsRUFBRSxDQUFDLENBQUMsU0FBUyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztnQkFDN0IsVUFBVSxHQUFHLElBQUksQ0FBQztnQkFDbEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyx5QkFBeUIsQ0FBQyxDQUFDO2dCQUN2QyxFQUFFLENBQUMsU0FBUyxDQUFDLEtBQUssRUFBRSxHQUFHLEVBQUUsQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFDckQsQ0FBQztRQUNILENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDIn0= |
{ | ||
"name": "frets-styles-generator", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "Tool that genreates a typescript class for FRETS based on a CSS file", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
@@ -11,5 +11,9 @@ # frets-styles-generator | ||
And here is more recommended starter packages with common postcss pluugins, basecss library, and support for @import. | ||
`npm install postcss-cli postcss-import postcss-preset-enc purgecss purge-css-from-frets cssnano basscss basscss-addons basscss-basic -D` | ||
## Usage | ||
`node node_modules/.bin/frets-styles-generator` | ||
`npx frets-styles-generator` | ||
@@ -20,2 +24,5 @@ The first argument you pass to the program will be the directory to scan for CSS files. It defaults to "./src" if you leave the argument out. Each CSS file that is found will be run through postcss (utilizing the [postcss-import](https://github.com/postcss/postcss-import) plugin by default) and then turned into a .ts file like [orginialFilename-styles.ts] based on the template specified. The default template is for [maquette](https://github.com/AFASSoftware/maquette) hyperscript functions. | ||
Used in conjunction with FRETS and/or another hyperscript implementation. This particular template is specifically for the Maquette hyperscript implementation. Meaning it outputs a ts file that expects maquette to be available for import, so you will need 'maquette' in your project as a dependency. | ||
## Other Options | ||
Includes an optional watch flag `-w`. | ||
@@ -25,4 +32,55 @@ | ||
Used in conjunction with FRETS and/or another hyperscript implementation. This particular template is specifically for the Maquette hyperscript implementation. Meaning it outputs a ts file that expects maquette to be available for import, so you will need 'maquette' in your project as a dependency. | ||
Setting the `-p` or `--purge` flag will allow the use of purgecss. | ||
## Purging unused CSS | ||
The generation of the typescript class suffers from the same inefficiency as atomic CSS. It includes a bunch of members that you may not be currently using in your actual source code. The atomic CSS people have found that using [purgecss](https://www.purgecss.com/) will greatly reduce file size by scanning your source code files for classnames that are used and only including those selectors in the final css outoput. | ||
We can use the same technology for two purposes in FRETS. First, we configure postcss to scan our `src/**/.ts` files with the custom extractor [purgecss-from-frets](https://www.npmjs.com/package/purgecss-from-frets) and when we use PostCSS to compile browser-ready css we will get only the selectors that are neccessary! | ||
Here's my sample postcss config. | ||
```js | ||
const postcssPresetEnv = require('postcss-preset-env'); | ||
var atImport = require("postcss-import"); | ||
var purgecss = require("@fullhuman/postcss-purgecss"); | ||
var purgeFromFrets = require("purgecss-from-frets"); | ||
module.exports = { | ||
plugins: [ | ||
atImport(), | ||
postcssPresetEnv({ | ||
stage: 1, | ||
browsers: 'last 2 versions' | ||
}), | ||
purgecss({ | ||
content: ['./src/components/**/*.ts'], | ||
extractors: [ | ||
{ extractor: purgeFromFrets, extensions: ["ts"] } | ||
], | ||
whitelist: ['html', 'body', 'input', 'button', 'select'], | ||
whitelistPatterns: [/icon/, /green/], | ||
rejected: true | ||
}) | ||
// cssnano({ | ||
// preset: 'default', | ||
// }) | ||
], | ||
input: 'src/base.css', | ||
dir: 'dist' | ||
} | ||
``` | ||
Now to solve the other half of the problem. Normally when frets-styles-generator analyzes your source css file it purposefully removes the purgecss plugin so that you have access to the entire set of class names from your css file when writing typscript code. | ||
But, during your build script you can actually re-generate the `*-styles.ts` files with the `-p` flag to allow purgecss to remove unused selectors from your typescript class too! This will significantly decrease the size of your `*-styles.ts` files before they get compiled into final javascript bundles by webpack. | ||
Here's a sample build script from my package.json. | ||
```json | ||
"build:prod": "frets-styles-generator src/base.css src/base-styles.ts -p && cross-env NODE_ENV=production webpack -p && npm run css && npm run css:minify", | ||
``` | ||
I find it especially useful for rapid prototyping if you point it at [BaseCSS](https://github.com/basscss/bassplate) or [tachyons](http://tachyons.io/) because then you have a chainable typescript method for every "atomic" css class. | ||
@@ -33,1 +91,3 @@ | ||
See the [current maquette template](https://gitlab.com/FRETS/frets-styles-generator/blob/master/src/templates/maquette.ts) for an example. | ||
It should be possible to build templates for using the preact, react, or vue hyperscript functions. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
188219
399
1
90