Skip to content

Instantly share code, notes, and snippets.

@sergi
Created January 9, 2015 12:46
Show Gist options
  • Save sergi/6cee6f4dcf26312c4ce3 to your computer and use it in GitHub Desktop.
Save sergi/6cee6f4dcf26312c4ce3 to your computer and use it in GitHub Desktop.
Add less processing
From a605d8e9440240fa6a26ece012c058bd302c981a Mon Sep 17 00:00:00 2001
From: Sergi Mansilla <[email protected]>
Date: Fri, 9 Jan 2015 13:43:15 +0100
Subject: [PATCH] Added automatic processing of *.less files using 'gulp-less'
and grouped browserify script processing and less file processing in the
'default' gulp task.
---
gulpfile.js | 27 ++++++++++++---------------
package.json | 1 +
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/gulpfile.js b/gulpfile.js
index 69a9a98..64e7a55 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,22 +1,19 @@
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
+var less = require('gulp-less');
+var path = require('path');
-gulp.task('default', function() {
+gulp.task('scripts', function() {
return browserify('./init.js')
- .bundle()
- .pipe(source('bundle.js'));
+ .bundle()
+ .pipe(source('bundle.js'));
});
-// var browserify = require('browserify');
-// var gulp = require('gulp');
-// var source = require('vinyl-source-stream');
-
-// gulp.task('browserify', function() {
-// return browserify('./src/javascript/app.js')
-// .bundle()
-// //Pass desired output filename to vinyl-source-stream
-// .pipe(source('bundle.js'))
-// // Start piping stream to tasks!
-// .pipe(gulp.dest('./build/'));
-// });
\ No newline at end of file
+gulp.task('less', function () {
+ gulp.src('./styles/**/*.less')
+ .pipe(less({ paths: [ path.join(__dirname, 'less', 'includes') ] }))
+ .pipe(gulp.dest('./styles'));
+});
+
+gulp.task('default', ['scripts', 'less']);
diff --git a/package.json b/package.json
index 4983690..035ee75 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"devDependencies": {
"browserify": "^8.0.3",
"gulp": "^3.8.10",
+ "gulp-less": "^2.0.1",
"hbsfy": "^2.2.1",
"vinyl-source-stream": "^1.0.0",
"watchify": "^2.2.1"
--
1.8.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment