-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gulp setup working + the forgotten gitignore
made sure that during the development it won't minify or combine any files to have quick browser refreshes and style injections added in all the dependencies so I can squeeze them all in one file per type(except for the fonts)
- Loading branch information
Showing
24 changed files
with
4,253 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
var gulp = require("gulp"), | ||
|
||
haml = require("gulp-haml-coffee"), | ||
stylus = require("gulp-stylus"), | ||
|
||
autoprefix = require("gulp-autoprefixer"), | ||
uglify = require("gulp-uglify"), | ||
cssnano = require("gulp-cssnano"), | ||
|
||
del = require("del"), | ||
gulpIf = require("gulp-if"), | ||
useref = require("gulp-useref"), | ||
runSequence = require("run-sequence"), | ||
browserSync = require("browser-sync"); | ||
|
||
// Environment | ||
const | ||
PRODUCTION = false, | ||
DEV_DIR = "src", | ||
PROD_DIR = "dist"; | ||
var server = PRODUCTION ? PROD_DIR : DEV_DIR; | ||
|
||
// Build task should be run before running the default task | ||
gulp.task("build", function(callback) { | ||
runSequence("clean", ["fonts", "stylus", "haml"], "useref", callback); | ||
}); | ||
|
||
gulp.task("build--dev", function(callback) { | ||
runSequence(["stylus", "haml"], callback); | ||
}); | ||
|
||
|
||
gulp.task("default", function(callback) { | ||
runSequence("browserSync", PRODUCTION ? "watch" : "watch--dev", callback); | ||
}); | ||
|
||
|
||
gulp.task("browserSync", function() { | ||
browserSync({ | ||
server: server | ||
}); | ||
}); | ||
|
||
// Combining styles and scripts into one file each and minifying | ||
gulp.task("useref", function() { | ||
return gulp.src(DEV_DIR + "/*.html") | ||
.pipe(useref()) | ||
.pipe(gulpIf("*.js", uglify())) | ||
.pipe(gulpIf("*.css", cssnano())) | ||
.pipe(gulp.dest(PROD_DIR)) | ||
.pipe(browserSync.reload); | ||
}); | ||
|
||
// Compile | ||
gulp.task("haml", function() { | ||
return gulp.src(DEV_DIR + "/haml/**/*.haml") | ||
.pipe(haml()) | ||
.pipe(gulp.dest(DEV_DIR)) | ||
.pipe(gulpIf(!PRODUCTION, browserSync.reload({stream: true}))); | ||
}); | ||
|
||
gulp.task("stylus", function() { | ||
return gulp.src(DEV_DIR + "/stylus/**/*.styl") | ||
.pipe(stylus()) | ||
.pipe(autoprefix()) | ||
.pipe(gulp.dest(DEV_DIR + "/css")) | ||
.pipe(gulpIf(!PRODUCTION, browserSync.stream())); | ||
}); | ||
|
||
// Copy the fonts over | ||
gulp.task("fonts", function() { | ||
return gulp.src(DEV_DIR + "/fonts/**/*") | ||
.pipe(gulp.dest(PROD_DIR + "/fonts")); | ||
}); | ||
|
||
|
||
// Look for Haml, Stylus, and JS files for changes | ||
gulp.task("watch", function() { | ||
gulp.watch(DEV_DIR + "/haml/**/*.haml", function() { | ||
runSequence("haml", "useref"); | ||
}); | ||
gulp.watch(DEV_DIR + "/stylus/**/*.styl", function() { | ||
runSequence("stylus", "useref"); | ||
}); | ||
gulp.watch(DEV_DIR + "/js/**/*.js", "useref"); | ||
}); | ||
|
||
gulp.task("watch--dev", function() { | ||
gulp.watch(DEV_DIR + "/haml/**/*.haml", ["haml"]); | ||
gulp.watch(DEV_DIR + "/stylus/**/*.styl", ["stylus"]); | ||
gulp.watch(DEV_DIR + "/js/**/*.js").on("change", browserSync.reload); | ||
}); | ||
|
||
|
||
// Clean up dist | ||
gulp.task("clean", function() { | ||
return del.sync(['dist/**/*', '!dist/images', '!dist/images/**/*']); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "yet-another-portfolio", | ||
"version": "0.0.0", | ||
"description": "Personal portfolio in making", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/RuinIsProbablyTaken/yet-another-portfolio.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/RuinIsProbablyTaken/yet-another-portfolio/issues" | ||
}, | ||
"homepage": "https://github.com/RuinIsProbablyTaken/yet-another-portfolio#readme", | ||
"devDependencies": { | ||
"browser-sync": "^2.17.5", | ||
"del": "^2.2.2", | ||
"gulp": "^3.9.1", | ||
"gulp-autoprefixer": "^3.1.1", | ||
"gulp-cache": "^0.4.5", | ||
"gulp-cssnano": "^2.1.2", | ||
"gulp-haml-coffee": "0.0.6", | ||
"gulp-imagemin": "^3.1.1", | ||
"gulp-sass": "^2.3.2", | ||
"gulp-stylus": "^2.6.0", | ||
"gulp-uglify": "^2.0.0", | ||
"gulp-useref": "^3.1.2", | ||
"gulp-util": "^3.0.7", | ||
"lazypipe": "^1.0.1", | ||
"run-sequence": "^1.2.2" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.