gulp-lich-include

1.0.5 • Public • Published

gulp-lich-include

npm version GitHub version MIT Licence Build Status Coverage Status bitHound Dependencies bitHound Dev Dependencies bitHound Code

Lich.js dynamic include static resource gulpjs plugin.

Instructions.

install plugin.

npm i gulp-lich-include -D

In gulpfiles.

let gulp = require('gulp'),
    include = require('gulp-lich-include'),
    // Config File.
    config = require('./Lich.rules.config');

let test = function () {
    let injectObject = {
        env: 'test',
        name: 'dmoo'
    };

    return gulp.src('src/test.html', {base: './src'})
        .pipe(include(config, injectObject))
        .pipe(gulp.dest('./dist'));
};

gulp.task('default', test);

For more examples, see the example folder

Define a config file. Like Lich.rules.config.js

module.exports = {
    // developer directory.
    devDir: path.resolve(__dirname, 'src'),

    // template extension.
    tplExtension: '.swig',

    // javascript extension.
    jsExtension: '.js',

    // css extension.
    cssExtension: '.css',

    // command name.
    command: 'Lich',

    // declare rules.
    rules: {
        commonScripts: [{
            type: 'js-local',
            list: [
                'js/test.rule',
                'js/test1.rule'
            ]
        }, {
            type: 'js-npm',
            list: [
                'jquery/dist/jquery.min'
            ]
        }],
        commonStyles: [{
            type: 'css-local',
            list: [
                'css/test1',
                'css/test2'
            ]
        }, {
            type: 'css-npm',
            list: [
                'animate.css/animate'
            ]
        }]
    }
};

Local javascript include.

<!--Lich js-local="path/to/script"-->
<!--Lich js-local="path/to/script,path/to/other"-->

Local javascript merge.

<!-- Lich js-local-merge="path/to/merge.min:path/to/test1,path/to/test2"-->

Npm javascript include.

<!-- Lich js-npm="path/tp/script"-->
<!-- Lich js-npm="path/to/script,path/to/other"-->

Local style include.

<!--Lich css-local="path/to/style"-->
<!--Lich css-local="path/to/style,path/to/other"-->

Local style merge.

<!--Lich css-local-merge="path/to/merge:path/to/test,path/to/test1"-->

Npm style include.

<!-- Lich css-npm="path/to/style"-->
<!-- Lich css-npm="path/to/style,path/to/other"-->

Template include.

<!--Lich tpl="path/to/tpl"-->

Rule include.

<!--Lich rule="rule"-->

Readme

Keywords

Package Sidebar

Install

npm i gulp-lich-include

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • dmoosocool