Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var gulp = require('gulp'),
- sass = require('gulp-sass'),
- jade = require('gulp-jade-php'),
- concat = require('gulp-concat'),
- notify = require('gulp-notify'),
- cssmin = require('gulp-cssmin'),
- rename = require('gulp-rename'),
- uglify = require('gulp-uglify'),
- autoprefixer = require('gulp-autoprefixer');
- var path = {
- src: {
- styles: 'git/**/*.scss',
- scripts: 'git/**/scripts/*.js',
- jade: 'git/**/*.jade'
- },
- publicPath: "../",
- npm: {
- jquery: 'bower_components/jquery/dist/jquery.min.js',
- bootstrap: 'bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
- swiper: 'bower_components/swiper/dist/js/swiper.jquery.min.js'
- },
- watch: {
- styles: 'git/**/*.scss',
- scripts: 'git/**/*.js',
- jade: 'git/**/*.jade'
- }
- };
- var scriptPaths = [path.src.scripts, path.npm.jquery, path.npm.bootstrap, path.npm.swiper];
- // Styles //
- gulp.task('styles', function () {
- return gulp.src(path.src.styles)
- .pipe(sass())
- .pipe(autoprefixer({
- browsers: ['last 50 versions']
- }))
- .pipe(notify({
- message: 'Sass Success'
- }))
- .pipe(gulp.dest(path.publicPath))
- });
- gulp.task('build:styles', function () {
- return gulp.src(path.src.styles)
- .pipe(sass())
- .pipe(autoprefixer({
- browsers: ['last 50 versions']
- }))
- .pipe(cssmin())
- .pipe(rename({
- suffix: '.min'
- }))
- .pipe(notify({
- message: 'Sass Success'
- }))
- .pipe(gulp.dest(path.publicPath))
- });
- // HTML //
- gulp.task('html', function () {
- return gulp.src(path.src.jade)
- .pipe(jade({
- pretty: true
- }))
- .pipe(notify({
- message: 'Jade Success'
- }))
- .pipe(gulp.dest(path.publicPath))
- });
- // Scripts //
- gulp.task('scripts', function () {
- return gulp.src(scriptPaths)
- .pipe(concat('script.js'))
- .pipe(notify({
- message: 'Javascript Success'
- }))
- .pipe(gulp.dest(path.publicPath))
- });
- gulp.task('build:scripts', function () {
- return gulp.src(scriptPaths)
- .pipe(concat('script.js'))
- .pipe(uglify())
- .pipe(rename({
- suffix: '.min'
- }))
- .pipe(notify({
- message: 'Javascript Success'
- }))
- .pipe(gulp.dest(path.publicPath))
- });
- // Watch //
- gulp.task('watch', function () {
- gulp.watch(path.watch.styles, ['styles']);
- gulp.watch(path.watch.scripts, ['scripts']);
- gulp.watch(path.watch.jade, ['html']);
- });
- gulp.task('default', ['styles', 'scripts', 'html']);
- gulp.task('build', ['build:styles', 'build:scripts', 'html']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement