задача — считать, сколько времени я провожу за работой
bower_components
builds
node_modules
src/
fonts/
img/
template/
header.html
footer.html
. . . . . . . .
js/
script.js
sass/
_base.scss
_butons.scss
_fonts.scss
_forms.scss
_media.scss
_mixins.scss
_sprite.scss
_style.scss
_variables.scss
main.scss
index.html
.gitignore
bower.json
gulpfile.js
package.json
css/
main.css
vendor.css
fonts/
img/
js/
script.js
vendor.js
index.html
import/from
вместо require
?.header{
height: 20px;
background-color: red;
position: relative;
z-index: 1000;
}
.slider{
position: relative;
z-index: 1;
height: 300px;
background-color: grey;
}
.slider::before {
box-shadow: 0 2px 8px #000;
content: "";
position: absolute;
top: -8px;
width: 100%;
height: 8px;
}
'use strict';
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const uglify = require('gulp-uglify');
const useref = require('gulp-useref');
const rename = require('gulp-rename');
const browserify = require('browserify');
const babelify = require('babelify');
const buffer = require('vinyl-buffer');
const source = require('vinyl-source-stream');
const sourcemaps = require('gulp-sourcemaps');
// use default task to launch Browsersync and watch JS files
gulp.task('serve', ['js'], () => {
// Serve files from the root of this project
browserSync.init({
proxy: "localhost"
});
// add browserSync.reload to the tasks array to make
// all browsers reload after tasks are complete.
gulp.watch("src/*.js", ['js']);
gulp.watch("*.html").on("change", browserSync.reload);
gulp.watch("dist/*.js").on("change", browserSync.reload);
gulp.watch("ssi/*.shtml").on("change", browserSync.reload);
gulp.watch("css/*.css").on("change", browserSync.reload);
});
// process JS files and return the stream.
gulp.task('js', () => {
let bundler = browserify({
entries: 'src/main.js',
debug: true
});
bundler
.transform(babelify, {
presets: ['es2015'],
compact: false,
ignore: /libs/
})
.transform('browserify-shim');
bundler.bundle()
.on('error', err => console.error(err))
.pipe(source('main.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
// create a task that ensures the `js` task is complete before
// reloading browsers
gulp.task('default', ['serve']);