Novel Preposterous Mockery
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

gulp-inline-source

4.0.0 • Public • Published

gulp-inline-source

NPM Version Build Status Semantic Release Commitizen friendly

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 gulp-inline-source --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
    };
 
    return gulp.src('./src/*.html')
        .pipe(inlinesource(options))
        .pipe(gulp.dest('./out'));
});

install

npm i gulp-inline-source

Downloadsweekly downloads

8,292

version

4.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability