Skip to content

Commit 15cbf72

Browse files
Implement slightly modified/updated gulp-blender
1 parent 003b97b commit 15cbf72

25 files changed

+481
-0
lines changed

.jshintrc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"predef": [
3+
"define",
4+
"require",
5+
"requirejs",
6+
"Modernizr"
7+
],
8+
"node" : true,
9+
"jquery" : true,
10+
"browser" : true,
11+
"boss" : true,
12+
"curly": true,
13+
"debug": false,
14+
"devel": true,
15+
"eqeqeq": true,
16+
"evil": true,
17+
"forin": false,
18+
"immed": false,
19+
"laxbreak": false,
20+
"newcap": true,
21+
"noarg": true,
22+
"noempty": false,
23+
"nonew": false,
24+
"nomen": false,
25+
"onevar": false,
26+
"plusplus": false,
27+
"regexp": false,
28+
"undef": true,
29+
"sub": true,
30+
"strict": false,
31+
"white": false,
32+
"eqnull": true,
33+
"esnext": true,
34+
"camelcase": true,
35+
"indent": 2,
36+
"quotmark": "single",
37+
"trailing": true,
38+
"unused": true
39+
}

blender.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"version": "2.0.0-alpha",
3+
"env": {
4+
"development": {
5+
"dir": "./dev/"
6+
},
7+
"production": {
8+
"dir": "./dist/"
9+
}
10+
},
11+
"cmd": {
12+
"stage": "./bin/stage.sh",
13+
"assets": "./bin/assets.sh",
14+
"deploy": "./bin/deploy.sh",
15+
"deployLive": "./bin/deploy-live.sh",
16+
"require": "./bin/require.sh"
17+
},
18+
"connect": {
19+
"port": "1337",
20+
"livereload": true
21+
},
22+
"templates": {
23+
"watchSrc": "./src/views/**/*.jade",
24+
"src": [
25+
"./src/views/**/*.jade",
26+
"!./src/views/**/_*.jade"
27+
]
28+
},
29+
"scripts": {
30+
"src": "./src/js/**/*.{js,map}",
31+
"jsFilter": [
32+
"**/*.js",
33+
"**/*.map"
34+
],
35+
"lint": {
36+
"config": "./.jshintrc",
37+
"exclude": [
38+
"!**/vendor/**/*"
39+
]
40+
},
41+
"subDir": "js/"
42+
},
43+
"images": {
44+
"src": "./src/img/**/*.{png,gif,jpg,jpeg}",
45+
"imgFilter": "**/*.{png,gif,jpg,jpeg}",
46+
"subDir": "img/"
47+
},
48+
"styles": {
49+
"watchSrc": "./src/scss/**/*.scss",
50+
"src": [
51+
"./src/scss/**/*.scss",
52+
"!./src/scss/**/_*.scss"
53+
],
54+
"cssFilter": "**/*.css",
55+
"scssFilter": "**/*.scss",
56+
"srcDir": "./src/scss/",
57+
"subDir": "css/"
58+
},
59+
"svg": {
60+
"src": "./src/img/**/*.svg",
61+
"subDir": "img/"
62+
},
63+
"ico": {
64+
"src": "./src/img/**/*.ico",
65+
"subDir": "img/"
66+
},
67+
"fonts": {
68+
"src": "./src/fonts/**/*",
69+
"subDir": "fonts/"
70+
},
71+
"bower": {
72+
"jsDest": "./src/js/vendor/",
73+
"imgDest": "./src/img/vendor/",
74+
"scssDest": "./src/scss/vendor/"
75+
}
76+
}

bower.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "docs-apis-is",
3+
"description": "Documentation for apis.is",
4+
"version": "2.0.0-alpha",
5+
"homepage": "http://docs.apis.is",
6+
"authors": [
7+
"Benedikt D Valdez <[email protected]>"
8+
],
9+
"license": "MIT",
10+
"private": true,
11+
"dependencies": {
12+
"jquery": "~2.1.3",
13+
"jquery-easing": "*",
14+
"normalize-scss": "~3.0.2",
15+
"requirejs": "~2.1.16",
16+
"requirejs-domready": "~2.0.1",
17+
"requirejs-plugins": "~1.0.3",
18+
"modernizr": "~2.8.3",
19+
"html5-polyfills": "*",
20+
"underscore": "~1.7.0"
21+
},
22+
"overrides": {
23+
"jquery": {
24+
"main": [
25+
"./dist/jquery.min.js",
26+
"./dist/jquery.min.map"
27+
]
28+
},
29+
"jquery-easing": {
30+
"main": "jquery.easing.min.js"
31+
},
32+
"requirejs-domready": {
33+
"main": "./domReady.js"
34+
},
35+
"modernizr": {
36+
"main": "./modernizr.js"
37+
},
38+
"html5-polyfills": {
39+
"main": [
40+
"./classList.js"
41+
]
42+
},
43+
"underscore": {
44+
"main": [
45+
"./underscore-min.js",
46+
"./underscore-min.map"
47+
]
48+
}
49+
}
50+
}

dev/.gitkeep

Whitespace-only changes.

dist/.gitkeep

Whitespace-only changes.

gulpfile.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
var gulp = require('gulp');
3+
4+
// Attach plugins and config to gulp object, simply to have it globally accessible
5+
gulp.plugin = require('gulp-load-plugins')();
6+
gulp.cfg = require('./blender.json');
7+
gulp.cfg.env.dir = gulp.plugin.util.env.prod ? gulp.cfg.env.production.dir : gulp.cfg.env.development.dir;
8+
9+
var loadTasks = require('gulp-load')(gulp);
10+
loadTasks(__dirname);

package.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"name": "docs-apis-is",
3+
"description": "Documentation for apis.is",
4+
"version": "2.0.0-alpha",
5+
"author": {
6+
"name": "Benedikt D Valdez",
7+
"email": "[email protected]",
8+
"url": "http://bdvs.info"
9+
},
10+
"bugs": {
11+
"url": "https://github.com/kristjanmik/apis/issues"
12+
},
13+
"contributors": [
14+
"Benedikt D Valdez <[email protected]>"
15+
],
16+
"devDependencies": {
17+
"bower": "^1.3.12",
18+
"del": "^1.1.1",
19+
"gulp": "^3.8.11",
20+
"gulp-autoprefixer": "^2.1.0",
21+
"gulp-bump": "^0.1.13",
22+
"gulp-changed": "^1.1.1",
23+
"gulp-connect": "^2.2.0",
24+
"gulp-csso": "^1.0.0",
25+
"gulp-filter": "^2.0.2",
26+
"gulp-jade": "^1.0.0",
27+
"gulp-jshint": "^1.9.2",
28+
"gulp-load": "^0.1.1",
29+
"gulp-load-plugins": "^0.8.0",
30+
"gulp-notify": "^2.2.0",
31+
"gulp-plumber": "^0.6.6",
32+
"gulp-rename": "^1.2.0",
33+
"gulp-replace": "^0.5.2",
34+
"gulp-sass": "^1.3.3",
35+
"gulp-uglify": "^1.1.0",
36+
"gulp-util": "^3.0.3",
37+
"gulp-wait": "0.0.2",
38+
"main-bower-files": "^2.5.0",
39+
"map-stream": "^0.0.5",
40+
"node-notifier": "^4.1.1",
41+
"open": "0.0.5",
42+
"q": "^1.1.2"
43+
},
44+
"engines": {
45+
"node": ">=0.10.17",
46+
"npm": ">=1.3.8"
47+
},
48+
"homepage": "http://docs.apis.is",
49+
"keywords": [
50+
"apis",
51+
"docs",
52+
"documentation"
53+
],
54+
"license": "MIT",
55+
"main": "gulpfile.js",
56+
"repository": {
57+
"type": "git",
58+
"url": "https://github.com/kristjanmik/apis.git"
59+
},
60+
"scripts": {}
61+
}

src/img/.gitkeep

Whitespace-only changes.

src/js/.gitkeep

Whitespace-only changes.

src/scss/.gitkeep

Whitespace-only changes.

src/views/.gitkeep

Whitespace-only changes.

tasks/bower.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
var mainBowerFiles = require('main-bower-files');
5+
6+
var bowerFiles = function() {
7+
var jsFilter = gulp.plugin.filter(gulp.cfg.scripts.jsFilter),
8+
imgFilter = gulp.plugin.filter(gulp.cfg.images.imgFilter),
9+
cssFilter = gulp.plugin.filter(gulp.cfg.styles.cssFilter),
10+
scssFilter = gulp.plugin.filter(gulp.cfg.styles.scssFilter);
11+
12+
return gulp.src(mainBowerFiles())
13+
.pipe( jsFilter )
14+
.pipe( gulp.dest(gulp.cfg.bower.jsDest) )
15+
.pipe( jsFilter.restore() )
16+
17+
.pipe( imgFilter )
18+
.pipe( gulp.dest(gulp.cfg.bower.imgDest) )
19+
.pipe( imgFilter.restore() )
20+
21+
.pipe( cssFilter )
22+
.pipe( gulp.plugin.rename({extname: '.scss'}) )
23+
.pipe( cssFilter.restore() )
24+
25+
.pipe( scssFilter )
26+
.pipe( gulp.dest(gulp.cfg.bower.scssDest) );
27+
};
28+
gulp.task('bower', bowerFiles);
29+
};

tasks/build.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('build', ['clean'], function() {
5+
return gulp.start('scripts', 'styles', 'templates', 'images', 'copy');
6+
});
7+
};

tasks/bump.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('bump', function() {
5+
var bumpType = 'patch';
6+
bumpType = gulp.plugin.util.env.minor ? 'minor' : bumpType;
7+
bumpType = gulp.plugin.util.env.major ? 'major' : bumpType;
8+
gulp.src(['./package.json','./bower.json','./blender.json'])
9+
.pipe( gulp.plugin.plumber() )
10+
.pipe( gulp.plugin.bump({type:bumpType}) )
11+
.pipe( gulp.dest('./') );
12+
});
13+
};

tasks/clean.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
var del = require('del');
5+
gulp.task('clean', function() {
6+
del(gulp.cfg.env.dir + '/*', function (err, deletedFiles) {
7+
console.log('Files deleted:', deletedFiles.join(', '));
8+
});
9+
return gulp.src(gulp.cfg.env.dir +'/*', {read: false});
10+
});
11+
};

tasks/connect.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('connect', function() {
5+
return gulp.plugin.connect.server({
6+
root: [gulp.cfg.env.dir],
7+
port: gulp.cfg.connect.port,
8+
livereload: gulp.cfg.connect.livereload
9+
});
10+
});
11+
};

tasks/copy.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('copy', function() {
5+
var path = gulp.cfg.env.dir;
6+
7+
gulp.src(gulp.cfg.ico.src)
8+
.pipe( gulp.dest(path + gulp.cfg.ico.subDir) );
9+
10+
gulp.src(gulp.cfg.svg.src)
11+
.pipe( gulp.dest(path + gulp.cfg.svg.subDir) );
12+
13+
gulp.src(gulp.cfg.fonts.src)
14+
.pipe( gulp.dest(path + gulp.cfg.fonts.subDir) );
15+
});
16+
};

tasks/cress.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
// Warning! Will overwrite any existing styles!
5+
gulp.task('cress', function() {
6+
var bower = require('bower');
7+
8+
return bower.commands.install(['cress','normalize-scss'],{save:true})
9+
.on('end', function() {
10+
11+
return gulp.src('./bower_components/cress/src/**/*')
12+
.pipe( gulp.plugin.plumber() )
13+
.pipe( gulp.dest(gulp.cfg.styles.srcDir) )
14+
.on( 'end', function(){
15+
return gulp.src('./src/views/shared/_head.jade')
16+
.pipe( gulp.plugin.replace('css/main.css','css/cress.css') )
17+
.pipe( gulp.dest('./src/views/shared/') );
18+
});
19+
});
20+
21+
});
22+
};

tasks/default.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('default', ['build']);
5+
};

tasks/images.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
module.exports = function(gulp) {
4+
gulp.task('images', function() {
5+
var gutil = gulp.plugin.util,
6+
prod = gutil.env.prod,
7+
imgDir = gulp.cfg.env.dir + gulp.cfg.images.subDir;
8+
9+
return gulp.src(gulp.cfg.images.src)
10+
.pipe( gulp.plugin.plumber() )
11+
.pipe( prod ? gutil.noop() : gulp.plugin.changed(imgDir) )
12+
13+
.pipe( gulp.dest(imgDir) )
14+
.pipe( prod ? gutil.noop() : gulp.plugin.connect.reload() );
15+
});
16+
};

0 commit comments

Comments
 (0)