Skip to content

icai/gulp-css2jsmap

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

gulp-css2jsmap

convert css collection files to javascript map object

NPM

Getting Started

you may install this plugin with this command:

npm install gulp-css2jsmap --save-dev

##Setup

Once the plugin has been installed, it may be enabled inside your gulpfile with this line of JavaScript:

var css2jsmap = require('gulp-css2jsmap');


gulp.task('gen:stylejs', ['gen:css'], function() {
    return gulp.src('src/skins/**/*.css')
        .pipe(css2jsmap({
	        prefix: 'var colorsStyle = ',
            path: "colorstyle.js",
        }))
        .pipe(gulp.dest('src/content'));
})

##Options

Plugin options are:

Property Necessary Type Plugin default value
[prefix] no 'String' 'var css2jsmap = '
[suffix] no 'String' ';'
path yes 'String' undefined

##Generated

var css2jsmap = {
	"filename1": "file contennt 1",
	"filename2": "file contennt 2",
	// ...

};

##Demo see the cozhihu project.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

License

Copyright (c) 2016 Terry Cai. Licensed under the MIT license.

About

convert css collection files to javascript map object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published