Tagged “build”
How to use npm as a build tool
Kieth Cirkel explains how using npm to run the scripts
field of package.json
is a great, simple alternative to more complex build tools. The article is now quite old but because it contains so many goodies, and since I’ve been using the approach more and more (for example to easily compile CSS on my personal website), it’s definitely worth bookmarking and sharing.
npm’s scripts directive can do everything that these build tools can, more succinctly, more elegantly, with less package dependencies and less maintenance overhead.
It’s also worth mentioning that (as far as I can tell so far) Yarn also provides the same facility.
Related references:
Saying bye-bye to autoprefixer
For a while now I’ve been using gulp-autoprefixer as part of my front-end build system. However, I’ve just removed it from my boilerplate. Here’s why.
The npm module gulp-autoprefixer
takes your standard CSS then automatically parses the rules and generates any necessary vendor-prefixed versions, such as ::-webkit-input-placeholder
to patch support for ::placeholder
in older Webkit browsers.
I’ve often felt it excessive—like using a hammer to crack a nut. And I’ve wondered if it might be doing more harm than good, by leading me to believe I have a magical sticking plaster for non-supporting browsers when actually (especially in the case of IE) the specific way in which a browser lacks support might be more nuanced. Furthermore I’ve never liked the noise generated by all those extra rules in my CSS output, especially when using the inspector to debug what would otherwise be just a few lines of CSS.
But I always felt it was a necessary evil.
However, I’ve just removed gulp-autoprefixer
from my boilerplate. Why? Because:
- Browsers are no longer shipping any new CSS with prefixes, and as at 2019, they haven’t been for years;
- With the browsers that do require prefixed CSS now old and in the minority, it feels like progressive enhancement rather than “kitchen sink” autoprefixing should take care of them. (Those browsers might not get the enhanced experience but what they’ll get will be fine.)
Jen Simmons’ tweet on this topic was the push I needed.
So I’ve removed one layer of complexity from my set-up, and so far nothing has exploded. Let’s see how it goes.
'Easy Sass' extension for Visual Studio Code (from wojciechsura on GitHub)
Automatically compiles SASS/SCSS files to .css and .min.css upon saving. You may also quickly compile all SCSS/SASS files in your project.
As I consider different ways in which to simplify my development stack and avoid excess tooling (much like Michelle Barker did), this might be worth a look.
(via @MicheBarks)
See all tags.