-
-
Save Alicannklc/0f57b68158c72ba6dee9ac3c272f7b2a to your computer and use it in GitHub Desktop.
Gulp
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
| const gulp = require('gulp'); | |
| const minify = require('gulp-minify'); | |
| const minifyCSS = require('gulp-minify-css'); | |
| const rename = require('gulp-rename'); | |
| const concat = require('gulp-concat'); | |
| gulp.task('styles', () => { | |
| gulp.src('source/css/**/*.css') | |
| .pipe(minifyCSS()) | |
| .pipe(rename({ suffix: '.min' })) | |
| .pipe(gulp.dest('dist/css')) | |
| }); | |
| gulp.task('scripts', () => { | |
| gulp.src(['source/js/**/*.js']) | |
| .pipe(concat('all.js')) | |
| .pipe(minify({ | |
| ext: { | |
| min: '.min.js' | |
| }, | |
| noSource: true | |
| })) | |
| .pipe(gulp.dest('dist/js')) | |
| }); | |
| gulp.task('watch', () => { | |
| gulp.watch('source/css/**/*.css', ['styles']); | |
| gulp.watch('source/js/**/*.js', ['scripts']); | |
| }); | |
| gulp.task('default', ['styles', 'scripts', 'watch']); |
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
| { | |
| "name": "project", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "devDependencies": { | |
| "gulp": "^3.9.1", | |
| "gulp-concat": "^2.6.1", | |
| "gulp-minify": "^2.1.0", | |
| "gulp-minify-css": "^1.2.4", | |
| "gulp-rename": "^1.2.2" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment