Gryp is a CLI tool built on top of Gulp.js that can compile assets based on a simple configuration file.
$ npm install gryp
A binary should have been created in the node modules directory, you can use it like this:
First, you need to create a
.gryp.yml file at the root of your project.
You can configure it in the next documentation sections.
Note: You can name and place the file wherever you want and tell Gryp to load
it by adding the
-c <grypFile> option when using it.
[-f <format:yml|json>]option to dump the file in yml/json.
--no-revin any of the dump commands.
Basically, Gryp takes all the sources you tell him to use, concatenates them,
and dumps them in another directory (default to
You can actually compile
If you add the
--prod option, Gryp will do some cool things for you:
css, Gryp uses
jsfiles, Gryp will use
gulp-sourcemapto fasten debugging in prod.
Additionnally, Gryp creates a "versioned" version of the file so that you can
use it in your production environment to avoid the browser caching the assets
when you need them to be reloaded (you can avoid this behavior by adding the
--no-rev option to your command).
As all versioned files names are dynamic, the
revisions command can dump all
of the revisions into a single file so you can just use it in your application
when resolving the assets' path.
Here is an example of a
.gryp.yml simple file:
assets:global_css:type: csssources:- web/css/base.css- web/css/custom_theme.cssoutput: global.cssglobal_js:type: jssources:- web/js/jquery.min.js- web/js/custom_functions.jsoutput: global.js
Take a look at the .gryp.example.yml file to see what you can do, and what is the default configuration.
/var/www/my_app $ node_modules/.bin/gryp dump --prodProcessed CSS "global_css" to output "/var/www/my_app/web/css/global.css"Processed JS "global_js" to output "/var/www/my_app/web/js/global.js"The manifest was dumped to /var/www/my_app/cache/rev-manifest.json
gulp.destcalls to allow specifying more "custom" compilation outputs, like
cssrewritefilter from Assetic)