Skip to content

Latest commit

 

History

History
105 lines (73 loc) · 2.11 KB

README.md

File metadata and controls

105 lines (73 loc) · 2.11 KB

gulp-assets

NPM version Build Status Coverage Status Dependency Status

assets plugin for gulp

Usage

First, install gulp-assets as a development dependency:

npm install --save-dev gulp-assets

Then, add it to your gulpfile.js:

var assets = require("gulp-assets");

gulp.src("./src/*.html")
	.pipe(assets({
		js: true,
        css: false
	}))
	.pipe(gulp.dest("./dist"));

API

assets(options)

options.js

Type: either a boolean or a string
Default: true

Whether you wish to get javascript files. If a string is used, only the javascript files between the appropriate comment tags will be used.

Example:

<!-- build:myJsTag -->
<script src="js/foo.js"></script>
<!-- endbuild -->
assets({
    js: 'myJsTag',
    css: false
})

You will only get js/foo.js in your build stream

options.css

Type: either a boolean or a string
Default: false

Whether you wish to get css files. If a string is used, only the css files between the appropriate comment tags will be used.

Example:

<!-- build:myCssTag -->
<link rel="stylesheet" href="css/foo.css"/>
<!-- endbuild -->
assets({
    js: false
    css: 'myCssTag',
})

options.cwd

Type: string
Default: undefined

If set, will be used as a base when building the files' paths.

Shortcuts methods:

assets.js(<optional tagname>); // Only js files (between comment tags if tagname is set)
assets.css(<optional tagname>); // Only css files  (between comment tags if tagname is set)

Contributors

  • @kjbekkelund
  • @Zweer
  • @shinnn

License

MIT License