Skip to content

kombucha/gulp-assets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A plugin for Gulp that extracts the javascript and css files from your html and makes them available to other gulp tasks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published