A CSS (clean-css) and JavaScript (UglifyJS) minifier plugin for Wintersmith.
The plugin is not published on NPM yet as it's in an early-stage. If you want to use the plugin now, you could add it as a Git submodule, import it using the Git URI, or make a local fork.
-
Create a file with this name pattern:
<output>.<filetype>.minify.json
Where:
-
<output>
is the name of the minified file. -
<filetype>
is the file extension (eitherjs
orcss
for now).
-
-
In this file, make a list of the files you want to minify in an
input
property.For instance, in
bundle.js.minify.json
:{ "input": [ "other-script.js", "../src/main.js" ] }
And in
bundle.css.minify.json
:{ "input": [ "normalize.css", "../src/main.css" ] }
Side note: If you want your source files not to be included and accessible in Wintersmith builds, you must place them outside the
contents
folder. -
Put every
*.*.minify.json
file in the path you want your minified file to be in, e.g.contents/script/bundle.js.minify.json
, andcontents/style/bundle.css.minify.json
. -
Use the minified file in your project without the postfix, e.g.:
<link rel="stylesheet" href="style/bundle.css"/> <script src="script/bundle.js"></script>
© Copyright 2017 Hazem AbuMostafa.
This project is subject to the Apache License, Version 2.0.