Skip to content

Commit

Permalink
gulp setup working + the forgotten gitignore
Browse files Browse the repository at this point in the history
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
slri committed Nov 11, 2016
1 parent df7b556 commit 1ae009c
Show file tree
Hide file tree
Showing 24 changed files with 4,253 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
98 changes: 98 additions & 0 deletions gulpfile.js
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/**/*']);
});
36 changes: 36 additions & 0 deletions package.json
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"
}
}
6 changes: 6 additions & 0 deletions src/css/bootstrap.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/css/devicon.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/css/font-awesome.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 1ae009c

Please sign in to comment.