Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(:zap:)
- Reducing boilerplate in the Gulpfile
- Removing browser sync
- Pushing some changes to the package.json instead
- Removing seemingly unused test.css file
  • Loading branch information
atomicpages committed Aug 23, 2020
commit d28e63536a1c923e15b79407a713c1a702de9606
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Desktop.ini
# Temporary files
coverage/
tmp
test
test/*.css

# Logs
.log
Expand Down
62 changes: 2 additions & 60 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const gulp = require('gulp');
const browserSync = require('browser-sync');

const sass = require('gulp-sass');
sass.compiler = require('sass');
Expand All @@ -12,39 +11,6 @@ const gulpStylelint = require('gulp-stylelint');
const cleanCSS = require('gulp-clean-css');
const del = require('del');

const reload = browserSync.reload;

/* BROWSER SYNC */
exports['browser-sync'] = function serve() {
browserSync({
port: 3040,
server: {
baseDir: './',
directory: true,
},
https: true,
});
};

/* BROWSER SYNC RELOAD */
exports['browser-sync-reload'] = function browserSyncReload() {
browserSync.reload();
};

/* LIST SCSS */
exports['lint:scss'] = function lintCSS() {
return gulp.src('src/**/*.scss').pipe(
gulpStylelint({
reporters: [
{
formatter: 'string',
console: true,
},
],
})
);
};

/* COMPILE SCSS */
exports['compile:scss'] = function compileSCSS() {
return gulp
Expand All @@ -61,32 +27,9 @@ exports['compile:scss'] = function compileSCSS() {
})
)
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('dist'))
.pipe(
browserSync.reload({
stream: true,
})
);
};

/* FORMAT CSS */
exports['format:css'] = function formatCSS() {
return gulp
.src('dist/*.css')
.pipe(
gulpStylelint({
fix: true,
failAfterError: false,
})
)
.pipe(gulp.dest('dist'));
};

/* CLEAN DIST */
exports['clean:dist'] = function cleanDist() {
return del(['dist']);
};

/* MINIFY CSS */
exports['minify:css'] = function minifyCSS() {
return gulp
Expand Down Expand Up @@ -117,16 +60,15 @@ exports['set:header'] = function setHeader() {
Source: <%= pkg.repository.link %>
Demo: <%= pkg.homepage %>

Copyright (c) <%= moment().format('YYYY') %> <%= _.capitalize(pkg.author) %>
Copyright (c) <%= new Date().getFullYear() %> <%= pkg.maintainers[0] %>
Originally By: <%= _.capitalize(pkg.author) %>
`)
)
.pipe(gulp.dest('dist'));
};

const build = gulp.series(
gulp.parallel(exports['clean:dist'], exports['lint:scss']),
exports['compile:scss'],
exports['format:css'],
exports['minify:css'],
exports['set:header']
);
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
"description": "A pure css library to beautify checkbox and radio buttons.",
"main": "dist/pretty-checkbox.min.css",
"scripts": {
"lint": "gulp lint:scss",
"fix": "stylelint \"src\\**\\*.scss\" --syntax scss --fix",
"format": "gulp css:format",
"clean": "del dist/",
"lint": "stylelint 'src/**/*.scss'",
"fix:scss": "npm run lint -- --fix",
"prebuild": "npm-run-all -p clean lint",
"pretest": "npm run build && cp dist/pretty-checkbox.css test/.",
"posttest": "del test/pretty-checkbox.css",
"build": "gulp build"
},
"publishConfig": {
Expand All @@ -15,8 +18,8 @@
"dependencies": {},
"devDependencies": {
"@djthoms/prettier-config": "^2.0.0",
"browser-sync": "^2.8.2",
"del": "^5.0.0",
"del-cli": "^3.0.1",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.0",
"gulp-clean-css": "^4.0.0",
Expand All @@ -25,8 +28,8 @@
"gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.1",
"gulp-stylelint": "^13.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"rimraf": "^3.0.0",
"sass": "^1.26.10",
"stylelint": "^13.6.1",
"stylelint-config-recommended": "^3.0.0",
Expand Down Expand Up @@ -66,6 +69,6 @@
"bugs": {
"url": "https://github.com/atomicpages/pretty-checkbox/issues"
},
"homepage": "https://lokesh-coder.github.io/pretty-checkbox",
"homepage": "https://pretty-checkbox.netlify.app/",
"prettier": "@djthoms/prettier-config"
}
Loading