Skip to content

Commit

Permalink
Update Gulp dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteMX committed May 12, 2021
1 parent 700ce6c commit b2a5bfb
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 535 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Grunt/node_modules
Gulp/node_modules
node_modules
dist
Expand Down
103 changes: 0 additions & 103 deletions Grunt/_Gruntfile.js

This file was deleted.

28 changes: 0 additions & 28 deletions Grunt/_package.json

This file was deleted.

127 changes: 72 additions & 55 deletions Gulp/_Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,111 @@
'use strict';

// What is the name of the style folder in this theme folder?
var sourceStyleFolder = '{{{ sourceStyleFolder }}}';
const sourceStyleFolder = '{{{ sourceStyleFolder }}}';

// What is the name of the style folder in the deployment folder?
var deploymentStyleFolder = '{{{ deploymentStyleFolder }}}';
const deploymentStyleFolder = '{{{ deploymentStyleFolder }}}';

// Browsersync feature, please specify the host & port of the running project (without http://)
var proxyAddress = '{{{ localAddress }}}';
const proxyAddress = '{{{ localAddress }}}';

/*
*************************************************************************
* Don't try to edit below this line, unless you know what you are doing *
*************************************************************************/
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync').create(),
path = require('path'),
sourcemaps = require('gulp-sourcemaps');

var sourceFolder = './' + sourceStyleFolder + '/',
sourceSassFolder = sourceFolder + 'sass/',
sourceCssFolder = sourceFolder + 'css/';

var deploymentFolder = './deployment/web/' + deploymentStyleFolder,
deploymentCssFolder = deploymentFolder + '/css/';
*************************************************************************
* Don't try to edit below this line, unless you know what you are doing *
*************************************************************************/

const path = require('path');
const gulp = require('gulp');
const sass = require('gulp-sass');
const browserSync = require('browser-sync').create();
const sourcemaps = require('gulp-sourcemaps');

const sourceFolder = './' + sourceStyleFolder + '/';
const sourceSassFolder = sourceFolder + 'sass/';
const sourceCssFolder = sourceFolder + 'css/';

const deploymentFolder = './deployment/web/' + deploymentStyleFolder;
const deploymentCssFolder = deploymentFolder + '/css/';

console.log(`Gulp is using the following folders:
sourceFolder: ${sourceFolder}
sourceSassFolder: ${sourceSassFolder}
sourceCssFolder: ${sourceCssFolder}
deploymentFolder: ${deploymentFolder}
deploymentCssFolder: ${deploymentCssFolder}
`);

gulp.task('build-sass', function () {
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder));
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder));
});

gulp.task('build', function () {
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder));
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder));
});

gulp.task('copy-css', function () {
return gulp.src(sourceCssFolder + '**/*.css')
.pipe(gulp.dest(deploymentCssFolder));
return gulp.src(sourceCssFolder + '**/*.css')
.pipe(gulp.dest(deploymentCssFolder));
});

gulp.task('watch:sass', function () {
gulp.watch('**/*.scss', { cwd: sourceSassFolder }, gulp.series('build-sass'));
gulp.watch('**/*.scss', {
cwd: sourceSassFolder
}, gulp.series('build-sass'));
});

gulp.task('watch:css', function () {
gulp.watch('**/*.css', { cwd: sourceCssFolder }, gulp.series('copy-css'));
gulp.watch('**/*.css', {
cwd: sourceCssFolder
}, gulp.series('copy-css'));
});

gulp.task('default', gulp.series(['watch:sass']));
gulp.task('css', gulp.series(['watch:css']));

// Browsersync
gulp.task('browsersync-sass', function () {
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder))
.pipe(browserSync.stream());
return gulp.src(sourceSassFolder + '**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest(sourceCssFolder))
.pipe(gulp.dest(deploymentCssFolder))
.pipe(browserSync.stream());
});

gulp.task('watch:browsersync-sass', function () {
gulp.watch('**/*.scss', { cwd: sourceSassFolder }, gulp.series('browsersync-sass'));
gulp.watch('**/*.scss', {
cwd: sourceSassFolder
}, gulp.series('browsersync-sass'));
});

gulp.task('browsersync', function () {
browserSync.init({
proxy: {
target: proxyAddress,
ws: true
},
online: true,
open: true,
reloadOnRestart: true,
notify: true,
ghostMode: false
});
browserSync.init({
proxy: {
target: proxyAddress,
ws: true
},
online: true,
open: true,
reloadOnRestart: true,
notify: true,
ghostMode: false
});
});

gulp.task('dev', gulp.parallel(['browsersync-sass', 'watch:browsersync-sass', 'browsersync']));
6 changes: 3 additions & 3 deletions Gulp/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"repository": "{{{ repository }}}",
"license": "MIT",
"dependencies": {
"browser-sync": "^2.26.7",
"browser-sync": "^2.26.14",
"gulp": "^4.0.2",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5"
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^3.0.0"
}
}
8 changes: 0 additions & 8 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ config.repository = pkg.repository;

target.all = function() {
target.gulp();
target.grunt();
};

target.gulp = function() {
Expand All @@ -22,13 +21,6 @@ target.gulp = function() {
.finalize();
};

target.grunt = function() {
createPackage("Grunt")
.append(runMustache("Grunt/_Gruntfile.js", config), { name: "Gruntfile.js" })
.append(runMustache("Grunt/_package.json", config), { name: "package.json" })
.finalize();
};

function createPackage(distname) {
mkdir("-p", "dist");

Expand Down
Loading

0 comments on commit b2a5bfb

Please sign in to comment.