Git Product home page Git Product logo

gulp-srizer's Introduction

gulpSrizer

Build Status

Easilly add the needed w3c Sri informations to your html and jade files.

Installation

Install this library via NPM:

npm install gulp-srizer --save

Usage

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

gulp.task('sri', function() {
    return gulp.src('path/to/your/jade/or/html/files')
        .pipe(srizer())
        .pipe(gulp.dest('/where/should/we/write/them'));
});

Options:

  • fileExt: resource's extension we want to add SRIs for (default: css, js)

example:

srizer({fileExt: 'css'});
// or
srizer({fileExt: ['css', 'js']});
  • path: where should we look for resource files. By default this path is inferred by the location of your html/jade files

example:

srizer({path: '/path/to/your/resources'});
  • algo: which hashing algorithm should be used (default: sha256)

example:

srizer({algo: 'sha512'});
  • prefix: where should we prepend of not the algorithm to the has or not (default: true)

example:

srizer({prefix: false});

Tip and tricks:

If you're using gulp-cdnizer or gulp-rev-all in your project, we suggest your sri task to be the last one.

##Tests Have mocha installed and: npm test

gulp-srizer's People

Contributors

odino avatar unlucio avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-srizer's Issues

Break by more then 16 resources

If i have more then 16 CSS and/or JS files as resources, the task breaks without any error message. The callback function from getSris will not be triggered.

Any Suggestions?

Window's slashes

The regex for "srcFileName" does not match window's slashes. Changing it to /..(/|)/g will make it work.

Could path be an array?

e.g.: .pipe($.srizer({ path: ['./public/css', './public/js'] }))

this seems to fail without a path entered and it works if I have only one path.

it takes so long time

I found out that when so many html files in one folder, it will loop to generate the hash for all css and js on that folder for each html file. Even if the html file doesn't referenced that js and css.
and it takes soo long time. I believe it can be improved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.