mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
22e13acd65
- All var declarations are now const or let as per ES6 - All comma-separated lists / chained declarations are now one declaration per line - This is for clarity/readability but also made running the var-to-const/let switch smoother - ESLint rules updated to match How this was done: - npm install -g jscodeshift - git clone https://github.com/cpojer/js-codemod.git - git clone git@github.com:TryGhost/Ghost.git shallow-ghost - cd shallow-ghost - jscodeshift -t ../js-codemod/transforms/unchain-variables.js . -v=2 - jscodeshift -t ../js-codemod/transforms/no-vars.js . -v=2 - yarn - yarn test - yarn lint / fix various lint errors (almost all indent) by opening files and saving in vscode - grunt test-regression - sorted!
69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
const gulp = require('gulp');
|
|
|
|
// gulp plugins and utils
|
|
const gutil = require('gulp-util');
|
|
const livereload = require('gulp-livereload');
|
|
const postcss = require('gulp-postcss');
|
|
const sourcemaps = require('gulp-sourcemaps');
|
|
const zip = require('gulp-zip');
|
|
|
|
// postcss plugins
|
|
const autoprefixer = require('autoprefixer');
|
|
const colorFunction = require('postcss-color-function');
|
|
const cssnano = require('cssnano');
|
|
const customProperties = require('postcss-custom-properties');
|
|
const easyimport = require('postcss-easy-import');
|
|
|
|
const swallowError = function swallowError(error) {
|
|
gutil.log(error.toString());
|
|
gutil.beep();
|
|
this.emit('end');
|
|
};
|
|
|
|
const nodemonServerInit = function () {
|
|
livereload.listen(1234);
|
|
};
|
|
|
|
gulp.task('build', ['css'], function (/* cb */) {
|
|
return nodemonServerInit();
|
|
});
|
|
|
|
gulp.task('css', function () {
|
|
const processors = [
|
|
easyimport,
|
|
customProperties,
|
|
colorFunction(),
|
|
autoprefixer({browsers: ['last 2 versions']}),
|
|
cssnano()
|
|
];
|
|
|
|
return gulp.src('assets/css/*.css')
|
|
.on('error', swallowError)
|
|
.pipe(sourcemaps.init())
|
|
.pipe(postcss(processors))
|
|
.pipe(sourcemaps.write('.'))
|
|
.pipe(gulp.dest('assets/built/'))
|
|
.pipe(livereload());
|
|
});
|
|
|
|
gulp.task('watch', function () {
|
|
gulp.watch('assets/css/**', ['css']);
|
|
});
|
|
|
|
gulp.task('zip', ['css'], function () {
|
|
const targetDir = 'dist/';
|
|
const themeName = require('./package.json').name;
|
|
const filename = themeName + '.zip';
|
|
|
|
return gulp.src([
|
|
'**',
|
|
'!node_modules', '!node_modules/**',
|
|
'!dist', '!dist/**'
|
|
])
|
|
.pipe(zip(filename))
|
|
.pipe(gulp.dest(targetDir));
|
|
});
|
|
|
|
gulp.task('default', ['build'], function () {
|
|
gulp.start('watch');
|
|
});
|