This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/gulpfile.js

65 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-04-23 07:30:10 +00:00
'use strict';
2016-05-27 22:25:38 +00:00
global.gulp = require('gulp');
global.plugins = require('gulp-load-plugins')();
2016-04-23 07:30:10 +00:00
2016-05-27 22:25:38 +00:00
global.config = {
2016-05-28 00:23:17 +00:00
autoprefixer: {
browsers: 'last 2 versions'
},
2016-04-23 07:30:10 +00:00
bowerDir: 'vendor/bower',
2016-05-28 00:23:17 +00:00
fonts: {
2016-05-28 07:35:14 +00:00
outputDir: 'source/assets/fonts'
2016-05-28 00:23:17 +00:00
},
htmlmin: {
collapseWhitespace: true
},
js: {
2016-05-28 07:35:14 +00:00
sourceDir: 'assets/js',
pattern: '/js/**/*.js',
outputDir: 'source/assets/js'
2016-05-28 00:23:17 +00:00
},
2016-05-26 18:14:35 +00:00
production: plugins.util.env.production || false,
2016-05-28 00:23:17 +00:00
sass: {
2016-05-28 07:35:14 +00:00
sourceDir: 'assets/sass',
pattern: '/**/*.sass',
outputDir: 'source/assets/css'
2016-05-28 00:23:17 +00:00
},
scss: {
2016-05-28 07:35:14 +00:00
pattern: '/**/*.scss'
2016-05-28 00:23:17 +00:00
}
2016-05-27 22:25:38 +00:00
}
2016-04-23 07:30:10 +00:00
2016-05-27 22:25:38 +00:00
global.app = {};
2016-04-23 07:30:10 +00:00
2016-05-28 07:35:14 +00:00
app.sass = function (paths, filename) {
2016-05-26 18:28:28 +00:00
gulp.src(paths)
2016-04-23 07:30:10 +00:00
.pipe(plugins.plumber())
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
.pipe(plugins.sassGlob())
.pipe(plugins.sass())
2016-05-28 00:23:17 +00:00
.pipe(plugins.autoprefixer(config.autoprefixer))
2016-04-23 07:30:10 +00:00
.pipe(plugins.concat(filename))
.pipe(plugins.if(config.production, plugins.cleanCss()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
.pipe(plugins.if(!config.production, plugins.refresh()))
2016-05-28 07:35:14 +00:00
.pipe(gulp.dest(config.sass.outputDir));
2016-04-23 07:30:10 +00:00
};
app.js = function (paths, filename) {
gulp.src(paths)
.pipe(plugins.plumber())
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
.pipe(plugins.concat(filename))
.pipe(plugins.if(config.production, plugins.uglify()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
2016-05-28 07:35:14 +00:00
.pipe(gulp.dest(config.js.outputDir));
2016-04-23 07:30:10 +00:00
};
app.copy = function (source, destination) {
gulp.src(source)
.pipe(gulp.dest(destination));
};
2016-05-27 22:25:38 +00:00
require('require-dir')('./gulp');