1.0.0 • Published 8 years ago

assetinjector v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Asset Injector

Easy asset injection with NPM.

Installation

npm i assetinjector --save-dev

Options

  • attributes (object) - Add attributes to <link> or <script> tags
  • basePaths (array) - List of folders with files inside to inject into the source file
  • omit (string) - A string to omit from the reference in the injection (useful if you output to a separate folder from assets)
  • source (string) - The source file that you want to inject into

Defaults

attributes: {
  'css': {
    rel: 'stylesheet',
    type: 'text/css'
  },
  'js': null
},
basePaths: [],
omit: '',
source: ''

Usage

Editing the Source File

Edit your source file to contain comments where you'd like to inject these files, and the semantic type should match the file extension you want to inject. For example:

To inject CSS:
<!--inject:css-->
<!--inject:stop-->

To inject JS:
<!--inject:js-->
<!--inject:stop-->

And then appropriate elements will be added between the comments.

Currently the module has support for JS and CSS files, but please request another if you'd like more.

NPM

var injector = require('assetinjector');
injector({source: './public/header.html', basePaths: ['./public/_css', './public/_js'], omit: './public'});

Gulp

Coming soon.

1.0.0

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago