Skip to content

BIFIT/gulp-inline-source

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-inline-source

NPM Version Build Status Dependency Status

Inline all <script>, <link> and <img> tags that contain the inline attribute with inline-source.

How it works

<!-- located at src/html/index.html -->
<html>
  <head>
    <!-- inline src/js/inlineScript.js -->
    <script src="../js/inlineScript.js" inline></script>
  </head>
  <body>
  </body>
</html>
// located at src/js/inlineScript.js

function test() {
  var foo = 'lorem ipsum';
  return foo;
}

Output:

<html>
  <head>
    <script>function test(){var a="lorem ipsum";return a}</script>
  </head>
  <body>
  </body>
</html>

Install

$ npm install https://github.com/BIFIT/gulp-inline-source.git --save-dev

Usage

var gulp = require('gulp');
var inlinesource = require('gulp-inline-source');

gulp.task('inlinesource', function () {
    return gulp.src('./src/*.html')
        .pipe(inlinesource())
        .pipe(gulp.dest('./out'));
});

Optionally, you can provide some options through an options object:

var gulp = require('gulp');
var inlinesource = require('gulp-inline-source');

gulp.task('inlinesource', function () {
    var options = {
        compress: false,
        es5: true
    };

    return gulp.src('./src/*.html')
        .pipe(inlinesource(options))
        .pipe(gulp.dest('./out'));
});

About

Inline flagged js & css sources.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 71.8%
  • HTML 28.2%