Created
October 9, 2015 21:17
-
-
Save pepelsbey/a7241d6482f0fbfb7f3a to your computer and use it in GitHub Desktop.
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
| var autoprefixer = require('gulp-autoprefixer'), | |
| beml = require('gulp-beml'), | |
| concat = require('gulp-concat'), | |
| cssmin = require('gulp-minify-css'), | |
| gulp = require('gulp'), | |
| htmlmin = require('gulp-htmlmin'), | |
| rename = require('gulp-rename'), | |
| sass = require('gulp-sass'), | |
| sync = require('browser-sync').create(); | |
| var paths = { | |
| html: 'src/**/*.html', | |
| styles: 'src/styles/*.scss' | |
| }; | |
| gulp.task('default', [ | |
| 'build', | |
| 'server', | |
| 'watch' | |
| ]); | |
| gulp.task('build', [ | |
| 'copy', | |
| 'html', | |
| 'styles' | |
| ]); | |
| gulp.task('server', function () { | |
| sync.init({ | |
| notify: false, | |
| server: { | |
| baseDir: 'dest/' | |
| } | |
| }); | |
| }); | |
| gulp.task('watch', function () { | |
| gulp.watch([ | |
| 'src/**', | |
| '!' + paths.html, | |
| '!' + paths.styles | |
| ], ['copy']); | |
| gulp.watch(paths.html, ['html']); | |
| gulp.watch(paths.styles, ['styles']); | |
| }); | |
| gulp.task('copy', function () { | |
| gulp.src([ | |
| 'src/**', | |
| '!' + paths.html, | |
| '!' + paths.styles, | |
| '!src/events{,/**}' | |
| ]) | |
| .pipe(gulp.dest('dest/')) | |
| .pipe(sync.stream()); | |
| }); | |
| gulp.task('html', function () { | |
| gulp.src(paths.html) | |
| .pipe(beml({ | |
| elemPrefix: '__', | |
| modPrefix: '--' })) | |
| .pipe(htmlmin({ | |
| removeComments: true, | |
| collapseWhitespace: true | |
| })) | |
| .pipe(rename(function (path) { | |
| var regex = /(\d{4})-(\d{2})-(\d{2})-\w+/; | |
| if (regex.test(path.basename)) { | |
| path.dirname = path.basename.replace(regex, '$1/$2/$3'); | |
| path.basename = 'index'; | |
| } | |
| })) | |
| .pipe(gulp.dest('dest/')) | |
| .pipe(sync.stream()); | |
| }); | |
| gulp.task('styles', function () { | |
| gulp.src('src/styles/screen.scss') | |
| .pipe(sass().on('error', sass.logError)) | |
| .pipe(autoprefixer()) | |
| .pipe(cssmin()) | |
| .pipe(gulp.dest('dest/styles/')) | |
| .pipe(sync.stream()); | |
| gulp.src('src/styles/ubuntu-*.scss') | |
| .pipe(sass().on('error', sass.logError)) | |
| .pipe(cssmin()) | |
| .pipe(concat('ubuntu.css')) | |
| .pipe(gulp.dest('dest/styles/')) | |
| .pipe(sync.stream()); | |
| }); |
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
| [23:15:33] Using gulpfile ~/Projects/…/gulpfile.js | |
| [23:15:33] Starting 'copy'... | |
| [23:15:33] Finished 'copy' after 9.13 ms | |
| [23:15:33] Starting 'html'... | |
| [23:15:33] Finished 'html' after 5.39 ms | |
| [23:15:33] Starting 'styles'... | |
| [23:15:33] Finished 'styles' after 11 ms | |
| [23:15:33] Starting 'build'... | |
| [23:15:33] Finished 'build' after 8.32 μs | |
| [23:15:33] Starting 'server'... | |
| [23:15:33] Finished 'server' after 13 ms | |
| [23:15:33] Starting 'watch'... | |
| [23:15:33] Finished 'watch' after 72 ms | |
| [23:15:33] Starting 'default'... | |
| [23:15:33] Finished 'default' after 7.31 μs | |
| [BS] Access URLs: | |
| ---------------------------------- | |
| Local: http://localhost:3000 | |
| External: http://10.0.1.7:3000 | |
| ---------------------------------- | |
| UI: http://localhost:3001 | |
| UI External: http://10.0.1.7:3001 | |
| ---------------------------------- | |
| [BS] Serving files from: dest/ | |
| [23:15:34] Starting 'copy'... | |
| [23:15:34] Finished 'copy' after 1.68 ms | |
| [23:15:34] Starting 'copy'... | |
| [23:15:34] Finished 'copy' after 928 μs | |
| [BS] 1 file changed (screen.css) | |
| [BS] 2 files changed (index.html, index.html) | |
| [BS] 1 file changed (ubuntu.css) | |
| [23:15:34] Starting 'copy'... | |
| [23:15:34] Finished 'copy' after 1.08 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment