gulp-jsfy
transform .css to .js append to <head>
Last updated 5 years ago by 59naga .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-jsfy 
SYNC missed versions from official npm registry.

gulp-jsfy NPM version Build Status

transform .css to .js append to <head>

Installation

$ npm install gulp-jsfy

Plugin Usage

gulp=   require 'gulp'
gulp.task 'default',->
  main=   require 'main-bower-files'
  jsfy=   require 'gulp-jsfy'
  concat= require 'gulp-concat'

  gulp.src main()
    .pipe jsfy dataurl:true
    .pipe concat 'bower_components.js'
    .pipe gulp.dest 'public_html'

Plugin Options

  • dataurl:false
    • true: Replace url(relative/URL) to url(DATAURI)
  • ignoreURL:false
    • true: Don't Replace url(URL)

How do transform to .js ?

It's transform .css into <link href="DATAURI">.js And resolve url() references. Becomes css is standalone.

Example

animate.css

@charset "UTF-8";
/*!
Animate.css - http://daneden.me/animate
Licensed under the MIT license - http://opensource.org/licenses/MIT

Copyright (c) 2014 Daniel Eden
...
*/

gulpfile.coffee

gulp= require 'gulp'
jsfy= require 'gulp-jsfy'

gulp.task 'default',->
  gulp.src 'animate.css'
    .pipe jsfy()
    .pipe gulp.dest './'

Execute gulp

$ npm install gulp gulp-jsfy coffee-script
$ gulp
# Finished 'default' after 37 ms

Become animate.css.js

(function(){
  var link=document.createElement('link');
  link.setAttribute('data-name','animate');
  link.setAttribute('rel','stylesheet');
  link.setAttribute('href',"data:text/css;charset=utf8;base64,QGNoYXJzZXQgIlVU..."
  document.head.appendChild(link);
})();

License

MIT

Current Tags

  • 0.1.6-beta                                ...           latest (5 years ago)

18 Versions

  • 0.1.6-beta                                ...           5 years ago
  • 0.1.6-alpha                                ...           5 years ago
  • 0.1.5                                ...           5 years ago
  • 0.1.5-rc.1                                ...           5 years ago
  • 0.1.5-rc.0                                ...           5 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 18
Dependencies (6)
Dev Dependencies (2)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |