0.0.2 • Published 8 years ago

gulp-process-ref v0.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
8 years ago

gulp-process-ref NPM version Build status

process css, js by html

Usage

First, install gulp-process-ref as a development dependency:

npm install --save-dev gulp-process-ref

Then, add it to your gulpfile.js:

Gulpfile

var htmlref = require('gulp-process-ref');

var jsprocess = fuunction(stream, dist){
stream.pipe(concat(name))
	.pipe(jshint('.jshintrc'))
	.pipe(jshint.reporter('jshint-stylish'))
	.pipe(load.uglify())
	.pipe(gulp.dest('./dist'+dist));
}
var cssprocess = function(stream, dist){
stream.pipe(load.concat(cname))
	.pipe(cleanCSS())
	.pipe(gulp.dest("./dist"+cdist));
}
 
gulp.task('html', function(){
	gulp.src("/*.html")
		.pipe(htmlref(jsprocess, cssprocss));
});

html

	<span class="buildjs" name="main.js" dist="/scripts/" />
	<script type="text/javascript" class="concat" base="../.." src="../../script/main.js"></script>
	<script type="text/javascript" class="concat" base="../.." src="../../script/config.js"></script>
	
	<span class="buildcss" name="main.css" dist="/styles/" />
	<link type="text/css" class="concat" base="../.." href="../../styles/main.css"></link>
	<link type="text/css" class="concat" base="../.." href="../../styles/style1.css"></link>

result

	<script type="text/javascript" src="/scripts/main.js"/>
	<link type="text/css" href="/styles/main.css" />