🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

gulp-component-inline

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-component-inline

Support for referencing artTemplate file (or css files) directly in JS by '__inline', then compile them into JS

1.1.2
latest
Source
npm
Version published
Weekly downloads
1
-93.33%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-component-inline

Build Status Coverage Status License

Gulp Plugin which inlines artTemplate file (or css files) directly in JS by '__inline', and compiles them into JS

Install

npm install gulp-header-license --save-dev

Basic Usage

const gulp = require('gulp');
const component = require('gulp-component-inline');

gulp.task('default', () =>
	gulp.src('src/*.js')
		.pipe(component())
		.pipe(gulp.dest('dist'))
);

The plugin can actively recognize which type of file do you want to compile. So it don't need any extra APIs, just use it simply in you task.

Example

index.js

__inline('../tmpl/index.tmpl');
__inline('../css/index.css');
__inline('../css/index.scss');

index.tmpl

<span class="menu-name">{{menu.title}}</span>

index.css

p {
  margin: 0;
}

index.scss

div {
  text-align: center;

  a {
    color: red;
  }
}

Finally, index.js will compile to what is bellow:

[function($data,$filename
/*``*/) {
var $utils=this,$helpers=$utils.$helpers,$escape=$utils.$escape,menu=$data.menu,$out='';$out+='<span class="menu-name">';
$out+=$escape(menu.title);
$out+='</span>\n';
return new String($out);
}][0];
__inline('p{margin:0}');
__inline('div{text-align:center}div a{color:red}');

Congratulations! You now have mastered the usage of the plugin.

License

MIT

Keywords

gulpplugin

FAQs

Package last updated on 09 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts