/pug-unpug

Optimizing work flow using webpack 2.x and pug compiler

Primary LanguageShell

Pug/Unpug

If It's Stupid And It Works, It's Not Stupid - Anonymous.

Webpack Dev Server (1.x, 2.x) may take a lot of time during *.pug files compilations using pug loader, despite it's cache. To avoid this during development "hide" files you're not working on before processing.

npm i
npm run unpug # changes all *.pug extensions to *.pxx in ./src. It won't affect any subfolders.
npm run unpug bar.pug # changes all *.pug extensions to *.pxx in ./src except ./src/bar.pug
npm run repug # restore all *.pxx ext to *.pug in ./src

Config

Default *.pug files directory is declared in dir variable in unpug.sh:3, default: ./src/.

Pre-commit

Right before commit *.pxx files are automatically changed to .pug and readded to current revision thanks to pre-commit indicator (package.json:17). Modify the git add scope for your purpose, for now it's all files.