Upgrade Gulp, remove unnecessary dev tasks (#194)

This commit is contained in:
William Durand 2024-07-02 11:17:33 +02:00 коммит произвёл GitHub
Родитель 5d24510722
Коммит d8b51a3623
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 814 добавлений и 7492 удалений

Просмотреть файл

@ -6,14 +6,14 @@
$ npm install
```
## Develop
Runs gulp. Builds and monitors SCSS files. SCSS sourcemaps. Hot reloading for CSS.
## Development
```
$ npm run dev
$ DEVELOPMENT=1 npm start
```
## Build
Compiles & minifies css.
## Production
```
$ npm run build
$ npm start
```

Просмотреть файл

@ -2,91 +2,37 @@
// Plugins
// ----------------------------------------------------------------------------------------
const gulp = require('gulp');
const browserSync = require('browser-sync');
const nodemon = require('gulp-nodemon');
const sass = require('gulp-sass')(require('sass'));
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const cleancss = require('gulp-clean-css');
const rename = require('gulp-rename');
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const autoprefixer = require('gulp-autoprefixer');
const cleancss = require('gulp-clean-css');
// ----------------------------------------------------------------------------------------
// Settings
// ----------------------------------------------------------------------------------------
const src = {
sass : 'styles/**/*.scss',
sass: 'styles/**/*.scss',
};
const dist = {
css : 'static',
css: 'static',
};
// ----------------------------------------------------------------------------------------
// Tasks
// ----------------------------------------------------------------------------------------
// Task: nodemon
// starts node server
gulp.task('nodemon', (cb) => {
let started = false;
return nodemon({ script: 'server.js' }).on('start', () => {
if (!started) {
cb();
started = true;
}
});
});
// Task: browser-sync
// Proxies node server and watches files for hot-reloading
gulp.task('browser-sync', gulp.series('nodemon', () => {
return browserSync.init(null, {
proxy: "http://localhost:8080",
files: ['static/**/*.{html,js,css}'],
port: 7000,
});
}));
// Task: sass
// sourcemaps, compile, minify, rename, move to dist
gulp.task('sass', () => {
return gulp.src(src.sass)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourcemaps.write())
.pipe(gulp.dest(dist.css))
.pipe(browserSync.reload({ stream: true }));
});
// Task: sass-prod
// sourcemaps, compile, minify, rename, move to dist
gulp.task('sass-prod', () => {
return gulp.src(src.sass)
return gulp
.src(src.sass)
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(cleancss())
.pipe(gulp.dest(dist.css))
.pipe(gulp.dest(dist.css));
});
// Task: build
// For Prod. Builds scss files.
gulp.task('build', gulp.series('sass-prod'));
// Task: Watch
// watches sass files and re-compiles on change
gulp.task('watch', gulp.series('browser-sync', 'sass', () => {
return gulp.watch(src.sass, gulp.series('saas'));
}));
// Task: default
// For Development. Starts server, watches files, hot-reloads
gulp.task('default', gulp.series('watch'));

8209
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -2,36 +2,27 @@
"name": "webext-compat-tool",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"prestart": "gulp build",
"dev": "DEVELOPMENT=1 gulp watch",
"build": "gulp build"
"prestart": "gulp build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mozilla/webext-compat-tool.git"
},
"keywords": [],
"author": "",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/mozilla/webext-compat-tool/issues"
},
"homepage": "https://github.com/mozilla/webext-compat-tool#readme",
"dependencies": {
"browser-sync": "^3.0.2",
"express": "^4.17.1",
"fs-extra": "11.2.0",
"gulp": "^4.0.2",
"gulp": "5.0.0",
"gulp-autoprefixer": "^8.0.0",
"gulp-clean-css": "^4.2.0",
"gulp-nodemon": "^2.5.0",
"gulp-rename": "^2.0.0",
"gulp-sass": "^5.0.0",
"gulp-sourcemaps": "^3.0.0",
"mappy-breakpoints": "^0.2.3",
"sass": "^1.77.6",
"susy": "^3.0.5"