Is there someone here who use the tool Parcel? https://parceljs.org/
I would like to find a simple tool to minify my Kirby css, js, html and to remove unused css in Tachyon (css framework) Is it the good tool for this?
Tanks for your advices
Not me; I use webpack for anything JS related and gulp for the rest, which is probably overly complicated…
Do let us know your findings please
Not yet, but I have been wanting to look into it for a while…
Finally, I’ve used a homemade solution to minify and remove unused css from my css framework (Tachyons).
- Installed = Nodejs + postcss + postcss CLI + cssnano + purgecss
- All CLI commands (minify and purge css on my Kirby files) are executed by a shell script
- Sublime Text call the shell script by setting up a Build System in Sublime Text
You can also use npm (specifically npm scripts) for that.
The added advantage is that these “scripts” are also defined in your
package.json file where the rest of your nodejs dependencies are also defined.
But you don’t use parceljs then? Why not? What witheld you from it?
This is exactly what I do… I created two setups, basically this which uses plain CLI tools via NPM scripts, or this which uses Laravel Mix. i built them to work with my framework, but they will work with anything.
Much tidier then a bash script.
I didn’t know npm script, thanks for the advice, I will take a look.
I tried to add just three css files in a test project and ParcelJS generate three corresponding js files. I didn’t understand why and didn’t want to spend to much time on it.
Parceljs seems more dedicated to JS web app than just minify and purge css.
Thanks for pointing that out!
You should definitely try npm out. Actually it’s just perfect for what you describe: postcss, sass, minifying and combining stuff, … If I shouldn’t have convinced you entirely, check out chokidar-cli too in this context: you can run
watchers with it so your npm scripts can run automatically when a file in the filetree you’re watching is changed.
The links James mentioned are a good way for checking out how he did it.
The biggest eye opener for me was reducing 1,200+ lines of Gulp code down to less then 20 lines of NPM scripts, for the same end result. Crazy!
Parallel shell is worth using too, particularly with watchers because you can only run one command consecutively with the CLI. It lets you run multiple instances of Chockidar (or any other command) concurrently.
Tried npm scripts, works like a charm
Next step, give a try to chokidar-cli
@gillesvauvarin Awesome. You might want to take a look at this article, it’s what got me interested in the first place. He gives some nice tips & tricks on doing stuff you probably wouldn’t have thought you could use it for.