Download the PHP package pug-php/pug-minify without Composer
On this page you can find all versions of the php package pug-php/pug-minify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pug-php/pug-minify
More information about pug-php/pug-minify
Files in pug-php/pug-minify
Package pug-minify
Short Description One keyword to minify them all (the assets: JS, CSS, Stylus, minify, Coffee, React) in your pug-php template.
License MIT
Informations about the package pug-minify
Pug-Minify
One keyword to minify them all (the assets: JS, CSS, Stylus, Less, Coffee, React) in your pug-php template.
Install
Usage
You can link the Minify instance to any keyword. Just remind that if you use or , the files will only be concatened and not minified, for any other keyword, they will be both concatened and minified.
By default concat and minification are not enable to allow you to debug it
easier, in production you should set the environment
option:
If you still use pug-php 2, production
is the default, you must set it
this way in your development environment:
Note that in pug-php 2, you must use ->setCustomOption
and
->setCustomOptions
for assetDirectory
, outputDirectory
and environment
options. With pug-php 3, you can now use
->setOption
and ->setOptions
for any option.
This will just transform (for stylus, less, coffee, etc.) and copy your assets to the output directory.
Now let's see what your template should look like:
In production, all and (with a stylesheet rel) tags of each minify block will be merged into one tag pointing to a minified version of all of them like this:
The generated files js/top.min.js, css/top.min.css and js/bottom.js are stored in the outputDirectory you specifed with the option. So you just must ensure will target {outputDirectory}/foo/bar.js.
Important: to improve performance in production, enable the Pug cache by setting the cache option to a writable directory, examples:
And clear this cache directory when your assets change or when you deploy new ones.
As the Pug cache feature allow to render the pug code only once, and so the assets, we do not incorporate a specific caching option in the Minify keyword.
Supported assets
.coffee
files are compiled into JS from CoffeeScript.cofp
handle CoffeeScript with pug inside tagged with.jsx
files are compiled into JS from JSX also used in React.jsxp
handle JSX with pug inside tagged with.styl
files are compiled into CSS from Stylus.less
files are compiled into CSS from Less
Embedded pug code can be multiline:
-
.cofp
.jsxp
All versions of pug-minify with dependencies
pug-php/pug Version ^2.0 || ^3.0
nodejs-php-fallback/less Version ^1.0
nodejs-php-fallback/stylus Version ^1.0
nodejs-php-fallback/coffeescript Version ^1.0
nodejs-php-fallback/react Version ^1.0
nodejs-php-fallback/uglify Version ^1.0.2