Skip to content

Instantly share code, notes, and snippets.

@michaeltroy
Last active August 29, 2015 14:02
Show Gist options
  • Save michaeltroy/f6dcaccbc7a58c8f219d to your computer and use it in GitHub Desktop.
Save michaeltroy/f6dcaccbc7a58c8f219d to your computer and use it in GitHub Desktop.
gulpfile.js
/*
* Require our plugins.
*/
var gulp = require('gulp'),
debug = require('gulp-debug'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
component = require('gulp-component')
/*
* Paths
*/
var paths = {
scripts: ['src/**/*.js'],
styles: ['component.json', 'src/**/*.css', 'src/**/*.scss']
};
/*
* Run default.
*/
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'sass', 'scripts');
});
/**
* Gulp clean.
*/
gulp.task('clean', function() {
return gulp.src('src/build/',
{read: false})
.pipe(clean());
});
/*
* Javascript tasks.
* gulp lint
* gulp scripts
*/
gulp.task('lint', function() {
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(component.scripts({
standalone: true,
out: 'src/build/'
}))
//.pipe(uglify())
.pipe(gulp.dest('src/build/'))
.pipe(notify({ message: 'Scripts task complete' }));
});
/*
* Stylesheets tasks.
* gulp sass
* gulp styles
*/
gulp.task('styles', function() {
return gulp.src(paths.styles)
.pipe(component.styles({
copy: true,
standalone: true,
out: 'src/build/'
}))
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
//.pipe(minifycss())
.pipe(gulp.dest('src/build/'))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('sass', function () {
gulp.src('src/build/index.scss')
.pipe(sass())
.pipe(gulp.dest('src/build/'));
});
/*
* Gulp Watch.
*/
gulp.task('watch', function () {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.styles, ['styles']);
})
{
"name": "content",
"version": "0.0.0",
"private": true,
"dependencies": {},
"devDependencies": {
"gulp": "^3.6.2",
"gulp-rename": "^1.2.0",
"gulp-css-rebase-urls": "0.0.5",
"gulp-clean": "^0.3.0",
"gulp-concat": "^2.2.0",
"gulp-autoprefixer": "^0.0.7",
"gulp-minify-css": "^0.3.4",
"gulp-uglify": "^0.3.0",
"gulp-notify": "^1.3.0",
"gulp-cache": "^0.1.11",
"gulp-jshint": "^1.6.1",
"gulp-livereload": "^1.5.0",
"gulp-shell": "^0.2.5",
"gulp-component": "^0.1.8",
"gulp-debug": "^0.3.0",
"gulp-ruby-sass": "^0.5.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment