Extract and concat YUI Loader meta data from YUI Modules
Node Version
≥ 0.10
Basic Usage
Extract meta from build YUI modules and concat to string representation of a
JavaScript object.
var yuiMeta =require("gulp-yui-meta");
gulp.task("templates",function(){
returngulp.src("./lib/build/*/*-min.js")
.pipe(yuiMeta("meta.js"))
.pipe(gulp.dest("./lib/build/meta"));
});
Supported meta data
The supported parameters for the YUI module configuration can be found in the
YUI Documentation.
Note
This plugin accounts for functions inside the module configuration and keeps
them executable in the outputted JavaScript Object. If you want to save the meta
data as a .json file you have to parse them out before.
Example
The following example of a gulp task assumes you have your build modules in
subfolders by module name in a ./public/build folder:
// Rename the file from `meta.js` to `meta-min.js`
.pipe(rename({suffix:"-min"}))
// Minify the meta file
.pipe(uglify())
// Write the minified file to disk
.pipe(gulp.dest("public/build/meta"));
});
This task generates a meta folder inside your public/build folder, which
will contain a raw (meta.js) and a minified (meta-min.js) version of your
YUI module meta.
Now you can use the meta file in your HTML like this: