gulpfile eslinted
This commit is contained in:
1 parent
b68ed4c8ed
commit
4944e8cd4f
1 file changed
+99
-103
+99
-103
@@ -1,143 +1,139 @@
|
||||
import gulp from 'gulp';
|
||||
import postcss from 'gulp-postcss';
|
||||
import sass from 'gulp-sass';
|
||||
import imageMin from 'gulp-imagemin';
|
||||
import uglify from 'gulp-uglify';
|
||||
import concat from 'gulp-concat';
|
||||
import webpack from 'webpack-stream';
|
||||
import named from 'vinyl-named';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import cssnano from 'cssnano';
|
||||
import ngAnnotate from 'gulp-ng-annotate';
|
||||
import $if from 'gulp-if';
|
||||
import gulp from 'gulp'
|
||||
import postcss from 'gulp-postcss'
|
||||
import sass from 'gulp-sass'
|
||||
import imageMin from 'gulp-imagemin'
|
||||
import uglify from 'gulp-uglify'
|
||||
import concat from 'gulp-concat'
|
||||
import webpack from 'webpack-stream'
|
||||
import named from 'vinyl-named'
|
||||
import autoprefixer from 'autoprefixer'
|
||||
import cssnano from 'cssnano'
|
||||
|
||||
let env = process.env['NODE_ENV'] || 'production';
|
||||
let isProduction = env === 'production';
|
||||
let env = process.env['NODE_ENV'] || 'production'
|
||||
let isProduction = env === 'production'
|
||||
|
||||
gulp.task('compile 3rdparty', () => {
|
||||
const files = [
|
||||
'./node_modules/jquery/dist/jquery.min.js',
|
||||
'./node_modules/angular/angular.min.js',
|
||||
'./node_modules/angular-route/angular-route.min.js',
|
||||
'./node_modules/angulartics/dist/angulartics.min.js',
|
||||
'./node_modules/angulartics-google-analytics/dist/angulartics-ga.min.js',
|
||||
'./node_modules/spin.js/spin.js',
|
||||
'./node_modules/angular-spinner/angular-spinner.min.js',
|
||||
'./node_modules/socket.io-client/socket.io.js',
|
||||
const files = [
|
||||
'./node_modules/jquery/dist/jquery.min.js',
|
||||
'./node_modules/angular/angular.min.js',
|
||||
'./node_modules/angular-route/angular-route.min.js',
|
||||
'./node_modules/angulartics/dist/angulartics.min.js',
|
||||
'./node_modules/angulartics-google-analytics/dist/angulartics-ga.min.js',
|
||||
'./node_modules/spin.js/spin.js',
|
||||
'./node_modules/angular-spinner/angular-spinner.min.js',
|
||||
'./node_modules/socket.io-client/socket.io.js',
|
||||
|
||||
'./node_modules/babel-polyfill/dist/polyfill.min.js'
|
||||
];
|
||||
'./node_modules/babel-polyfill/dist/polyfill.min.js'
|
||||
]
|
||||
|
||||
return gulp.src(files)
|
||||
return gulp.src(files)
|
||||
.pipe(concat('libs.js'))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('style', () => {
|
||||
const processors = [
|
||||
autoprefixer({
|
||||
browsers: ['last 1 version']
|
||||
}),
|
||||
cssnano({
|
||||
zindex: false
|
||||
})
|
||||
];
|
||||
const processors = [
|
||||
autoprefixer({
|
||||
browsers: ['last 1 version']
|
||||
}),
|
||||
cssnano({
|
||||
zindex: false
|
||||
})
|
||||
]
|
||||
|
||||
return gulp.src('./src/style/style.scss')
|
||||
return gulp.src('./src/style/style.scss')
|
||||
.pipe(sass())
|
||||
.pipe(postcss(processors))
|
||||
.pipe(concat('style.css'))
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('style-accessibility', () => {
|
||||
const processors = [
|
||||
autoprefixer({
|
||||
browsers: ['last 1 version']
|
||||
}),
|
||||
cssnano({
|
||||
zindex: false
|
||||
})
|
||||
];
|
||||
const processors = [
|
||||
autoprefixer({
|
||||
browsers: ['last 1 version']
|
||||
}),
|
||||
cssnano({
|
||||
zindex: false
|
||||
})
|
||||
]
|
||||
|
||||
return gulp.src('./src/style-accessibility/style.scss')
|
||||
return gulp.src('./src/style-accessibility/style.scss')
|
||||
.pipe(sass())
|
||||
.pipe(postcss(processors))
|
||||
.pipe(concat('style-accessibility.css'))
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('copy fonts', () => {
|
||||
return gulp.src('./src/assets/fonts/*/*')
|
||||
.pipe(gulp.dest('./public/fonts'));
|
||||
});
|
||||
return gulp.src('./src/assets/fonts/*/*')
|
||||
.pipe(gulp.dest('./public/fonts'))
|
||||
})
|
||||
|
||||
gulp.task('copy graphics', () => {
|
||||
return gulp.src('./src/assets/graphics/*')
|
||||
.pipe(gulp.dest('./public/graphics'));
|
||||
});
|
||||
return gulp.src('./src/assets/graphics/*')
|
||||
.pipe(gulp.dest('./public/graphics'))
|
||||
})
|
||||
|
||||
gulp.task('copy 3rdparty', () => {
|
||||
return gulp.src('./src/3rdparty/*')
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
return gulp.src('./src/3rdparty/*')
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('copy robots.txt', () => {
|
||||
return gulp.src('./robots.txt')
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
return gulp.src('./robots.txt')
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('copy templates', () => {
|
||||
return gulp.src('./src/templates/**')
|
||||
.pipe(gulp.dest('./out/templates'));
|
||||
});
|
||||
return gulp.src('./src/templates/**')
|
||||
.pipe(gulp.dest('./out/templates'))
|
||||
})
|
||||
|
||||
gulp.task('compile', () => {
|
||||
const doWatch = !isProduction;
|
||||
const doSourceMaps = !isProduction;
|
||||
const doWatch = !isProduction
|
||||
const doSourceMaps = !isProduction
|
||||
|
||||
return gulp.src([
|
||||
'./src/client/app.js'
|
||||
])
|
||||
return gulp.src([
|
||||
'./src/client/app.js'
|
||||
])
|
||||
.pipe(named())
|
||||
.pipe(webpack({
|
||||
devtool: doSourceMaps ? 'inline-source-map' : null,
|
||||
watch: doWatch,
|
||||
output: {
|
||||
filename: '[name].js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{test: /\.js$/, loader: 'babel'},
|
||||
{test: /\.html$/, loader: 'raw!html-minify'}
|
||||
]
|
||||
},
|
||||
'html-minify-loader': {
|
||||
empty: true,
|
||||
cdata: true,
|
||||
comments: false,
|
||||
dom: {
|
||||
lowerCaseAttributeNames: false
|
||||
}
|
||||
}
|
||||
}))
|
||||
// .pipe($if(isProduction, ngAnnotate()))
|
||||
// .pipe($if(isProduction, uglify()))
|
||||
.pipe(gulp.dest('./public'));
|
||||
});
|
||||
devtool: doSourceMaps ? 'inline-source-map' : null,
|
||||
watch: doWatch,
|
||||
output: {
|
||||
filename: '[name].js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{test: /\.js$/, loader: 'babel'},
|
||||
{test: /\.html$/, loader: 'raw!html-minify'}
|
||||
]
|
||||
},
|
||||
'html-minify-loader': {
|
||||
empty: true,
|
||||
cdata: true,
|
||||
comments: false,
|
||||
dom: {
|
||||
lowerCaseAttributeNames: false
|
||||
}
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('./public'))
|
||||
})
|
||||
|
||||
gulp.task('imagemin', () => {
|
||||
return gulp.src('./src/assets/graphics/**/*')
|
||||
return gulp.src('./src/assets/graphics/**/*')
|
||||
.pipe(imageMin())
|
||||
.pipe(gulp.dest('./public/graphics'));
|
||||
});
|
||||
.pipe(gulp.dest('./public/graphics'))
|
||||
})
|
||||
|
||||
gulp.task('production', () => {
|
||||
isProduction = true;
|
||||
});
|
||||
isProduction = true
|
||||
})
|
||||
|
||||
gulp.task('default', ['style', 'style-accessibility', 'compile']);
|
||||
gulp.task('copy', ['copy templates', 'copy fonts', 'copy graphics', 'copy 3rdparty', 'copy robots.txt']);
|
||||
gulp.task('deploy', ['default', 'copy', 'compile 3rdparty', 'imagemin']);
|
||||
gulp.task('compile production', ['production', 'compile']);
|
||||
gulp.task('default', ['style', 'style-accessibility', 'compile'])
|
||||
gulp.task('copy', ['copy templates', 'copy fonts', 'copy graphics', 'copy 3rdparty', 'copy robots.txt'])
|
||||
gulp.task('deploy', ['default', 'copy', 'compile 3rdparty', 'imagemin'])
|
||||
gulp.task('compile production', ['production', 'compile'])
|
||||
Reference in new issue
Block a user