Created
December 17, 2019 02:34
-
-
Save toddlucas/3fc06db52c08465e50fc493e215c2395 to your computer and use it in GitHub Desktop.
Gulp 4 with bootstrap 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.user | |
.DS_Store | |
**/node_modules/* | |
**/obj/* | |
**/bin/* | |
**/.vs/* | |
**/fontawesome/* | |
src/Gulp.Bootstrap/wwwroot/lib | |
src/Gulp.Bootstrap/wwwroot/scripts | |
src/Gulp.Bootstrap/wwwroot/styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <binding ProjectOpened='default' /> | |
'use strict'; | |
const gulp = require("gulp"); | |
const autoprefixer = require('gulp-autoprefixer'); | |
const minifycss = require('gulp-clean-css'); | |
const rename = require('gulp-rename'); | |
const sass = require('gulp-sass'); | |
const sourcemaps = require('gulp-sourcemaps'); | |
function scss() { | |
return gulp | |
.src("Styles/**/*.scss") | |
.pipe(sass({ | |
includePaths: [ | |
'node_modules' | |
], | |
outputStyle: "expanded" | |
})) | |
.pipe(sourcemaps.init()) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(autoprefixer()) | |
.pipe(gulp.dest("wwwroot/styles")) | |
.pipe(minifycss()) | |
.pipe(rename({ suffix: '.min' })) | |
.pipe(sourcemaps.write('.')) | |
.pipe(gulp.dest("wwwroot/styles")); | |
} | |
function css() { | |
return gulp | |
.src([ | |
"Styles/**/*.css" | |
]) | |
.pipe(gulp.dest("wwwroot/scripts")); | |
} | |
function icons() { | |
return gulp | |
.src([ | |
"node_modules/@fortawesome/fontawesome-free/svgs/solid/*.svg" | |
]) | |
.pipe(gulp.dest("wwwroot/images/fontawesome/svgs/solid")); | |
} | |
function js() { | |
return gulp.src([ | |
'node_modules/bootstrap/dist/js/*' | |
]) | |
.pipe(gulp.dest("wwwroot/scripts")); | |
} | |
function watch() { | |
gulp.watch("Styles/**/*.scss", scss); | |
} | |
const build = gulp.parallel(scss, css, js, icons); | |
exports.js = js; | |
exports.css = css; | |
exports.sass = scss; | |
exports.icons = icons; | |
exports.watch = watch; | |
exports.default = build; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gulp.bootstrap", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"private": true, | |
"devDependencies": { | |
"@fortawesome/fontawesome-free": "^5.12.0", | |
"bootstrap": "^4.4.1", | |
"gulp": "^4.0.2", | |
"gulp-autoprefixer": "^7.0.1", | |
"gulp-clean-css": "^4.2.0", | |
"gulp-rename": "^2.0.0", | |
"gulp-sass": "^4.0.2", | |
"gulp-sourcemaps": "^2.6.5" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment