1
0
mirror of https://github.com/arsenetar/arsenetar.github.io.git synced 2024-11-15 02:19:02 +00:00
arsenetar.github.io/assets/gulpfile.js
Andrew Senetar 44a02080a0 Convert Assets
Assets have been converted as follows:
- Change to gulp instead of grunt for build system
- Remove bower and manage with npm instead
- Change to postcss instead of sass
- Change to Pure.css instead of foundation (lighter weight)
- Update Icon Font
- Initial rework of site styling (layout will be committed with updated
  style later)
- Removed extra js which was not really needed
- Built js and css will be in the assets/dist directory

This really should have been probably 20 commits with a rebase or
something...
2015-06-09 22:28:50 -05:00

66 lines
1.6 KiB
JavaScript

// Requires
var gulp = require('gulp');
var del = require('del');
var runSequence = require('run-sequence');
var postcss = require('gulp-postcss');
var processors = [
require('postcss-import'),
require('postcss-mixins'),
require('postcss-nested'),
function(css) { /* Function to change some .pure classes to base elements */
css.eachRule(function (rule){
rule.selector = rule.selector.replace(/\.pure-table(\s+|-striped|$)/g,'table ');
rule.selector = rule.selector.replace(/\.pure-img/,'img');
});
},
require('cssnext')({
browsers: ['last 1 version', '> 5%'],
import: false,
compress: true
}),
require('csswring')({
removeAllComments: true
})
];
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
// Configuration
var config = {
'cssDir': 'css',
'jsDir': 'js',
'distDir': 'dist'
};
gulp.task('default', function(callback) {
return runSequence('clean',
['css', 'js'],
callback);
});
gulp.task('clean', function() {
del([config.distDir+'/**/*']);
});
gulp.task('css', function() {
return gulp.src([config.cssDir+'/app.css'])
.pipe(sourcemaps.init())
.pipe(postcss(processors))
.on('error', function (error) {
console.log(error);
})
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.distDir));
});
gulp.task('js', function() {
return gulp.src([config.jsDir+'/*.js'])
.pipe(concat('app.js'))
.pipe(sourcemaps.init())
.pipe(uglify({mangle: false}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.distDir));
});