Last active
September 11, 2017 04:12
-
-
Save TylerJPresley/64cd11090fb06875d111587aa0ca0333 to your computer and use it in GitHub Desktop.
Release task // Aurelia (CLI/RequireJS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as gulp from 'gulp'; | |
import * as sourcemaps from 'gulp-sourcemaps'; | |
import * as sass from 'gulp-sass'; | |
import * as autoprefixer 'gulp-autoprefixer'; | |
import * as cleanCSS from 'gulp-clean-css'; | |
import * as project from '../aurelia.json'; | |
import {build} from 'aurelia-cli'; | |
export default function processCSS() { | |
return gulp.src(project.cssProcessor.source) | |
.pipe(sourcemaps.init()) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(cleanCSS({ keepSpecialComments: 0 })) | |
.pipe(autoprefixer({ | |
browsers: ['last 2 versions', 'ie >= 9', 'and_chr >= 2.3'], | |
cascade: false | |
})) | |
.pipe(build.bundle()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as gulp from 'gulp'; | |
import * as htmlMin from 'gulp-htmlmin'; | |
import * as gzip from 'gulp-gzip'; | |
import * as del from 'del'; | |
import * as jsonMinify from 'gulp-json-minify'; | |
import * as vinylPaths from 'vinyl-paths'; | |
import * as stripDebug from 'gulp-strip-debug'; | |
import * as stripComments from 'gulp-strip-comments'; | |
const copyFnArray = []; | |
const copyList = [ | |
{ src: 'app/*-*.js', dest: './export/app' }, | |
{ src: 'assets/**/*', dest: './export/assets' }, | |
{ src: 'manifest.json', dest: './export' }, | |
{ src: 'index.html', dest: './export' } | |
]; | |
for (let i = 0, j = copyList.length; i < j; i++) { | |
copyFnArray.push(() => { | |
console.log(`copying item ${i + 1}`, copyList[i]); | |
return gulp.src(copyList[i].src) | |
.pipe(gulp.dest(copyList[i].dest)); | |
}); | |
} | |
function cleanExport() { | |
return gulp.src('./export') | |
.pipe(vinylPaths(del)); | |
} | |
function cleanApp() { | |
return gulp.src('./app') | |
.pipe(vinylPaths(del)); | |
} | |
function prepIndex() { | |
return gulp.src('./export/index.html') | |
.pipe(htmlMin({ collapseWhitespace: true })) | |
.pipe(gulp.dest('./export')) | |
.pipe(gzip()) | |
.pipe(gulp.dest('./export')); | |
} | |
function prepJs() { | |
return gulp.src('./export/**/*.js') | |
.pipe(stripDebug()) | |
.pipe(stripComments({ safe: true })) | |
.pipe(gulp.dest('./export')) | |
.pipe(gzip()) | |
.pipe(gulp.dest('./export')); | |
} | |
function prepJson() { | |
return gulp.src('./export/**/*.json') | |
.pipe(jsonMinify()) | |
.pipe(gulp.dest('./export')); | |
} | |
const release = gulp['series']( | |
cleanExport, | |
copyFnArray, | |
prepJs, | |
prepJson, | |
prepIndex, | |
cleanApp | |
); | |
export default release; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment