fallemand / build.scripts.inject

Example use of inject parameter of build.scripts.concat

Home Page:https://github.com/mercadolibre/ui-gulp_tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build.scripts.concat - inject

What is this?

This is an example of how to use the inject parameter of the task build.scripts.concat.
This parameter lets you inject JS files in others.

How it works

Inject is inactive by default in the ui-gulp_tasks, you need to activate it

1) Edit your gulpfile.js

var buildConcat = require('ui-gulp_tasks/tasks/build.scripts.concat');
buildConcat(gulp, paths, bundles, {
    'inject': true,
    'injectBasePath': './src/scripts/'
})

injectBasePath: This is the base path where inject with look for files.

For example, if you have this in your js file:
inject('components/filea');

Inject with look the file here:
./src/scripts/components/filea.js

2) Inject files: Example

inject('components/filea');

Do not put the .js extension.
The path is absolute starting from injectBasePath.

3) Generate the bundles, and they will have the injections.

npm run build

About

Example use of inject parameter of build.scripts.concat

https://github.com/mercadolibre/ui-gulp_tasks


Languages

Language:HTML 62.5%Language:JavaScript 29.1%Language:CSS 8.3%