Skip to content

Commit 156c95d

Browse files
complete overhaul
1 parent 1a12155 commit 156c95d

File tree

271 files changed

+22015
-27383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+22015
-27383
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# StreamBuilder
2+
3+
_WARNING: This documentation is out of date. New docs coming in the next 24-48 hours. (June 16th, 2016)
4+
25
##What it is
36
StreamBuilder is an automated build environment well suited for HTML, CSS and JavaScript prototyping. It runs on the (streaming) build system gulp.js. It uses the Jade template language to modularize html into templates, allowing developers to take a DRY approach to front-end development. Also included is the Sass CSS extension language.
47

gulpfile.js

Lines changed: 34 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,96 @@
11
var /* BEGIN ENVIRONMENT CONFIG */
2-
conf_bower_dest = './dist/bower_components', // where to output the bower directory
32
conf_image_dest = './dist/img', // where to output images
43
conf_output_dest = './dist', // the base output directory
54
conf_script_dest = './dist/js', // where to output scripts
65
conf_style_dest = './dist/css', // where to output styles
76
conf_template_dest = './dist', // where to output html templates
8-
conf_url_dest = 'localhost/streambuilder/dist', // the local URL of the project
7+
conf_url_dest = 'http://localhost/StreamBuilder/dist', // the local URL of the project
98
/* END ENVIRONMENT CONFIG */
109

1110
browsersync = require('browser-sync'),
1211
changed = require('gulp-changed'),
13-
clean = false,
14-
database = require('./src/db/database.json'),
1512
gulp = require('gulp'),
16-
gulpif = require('gulp-if'),
1713
gulputil = require('gulp-util'),
18-
jade = require('gulp-jade'),
14+
gulpwatch = require('gulp-watch'), // gulp-watch is not the same as gulp.watch !
1915
path = require('path'),
2016
reload = browsersync.reload,
21-
rimraf = require('rimraf'),
2217
sass = require('gulp-sass'),
2318
uglify = require('gulp-uglify');
2419

25-
26-
/**
27-
* Check to see if --vars were set.
28-
*/
29-
process.argv.forEach(function (val) {
30-
if (val === '--clean') {
31-
clean = true;
32-
}
33-
});
34-
35-
36-
/**
37-
* Remove dist directory.
38-
*/
39-
gulp.task('clean', function (cb) {
40-
rimraf(conf_output_dest, cb);
41-
});
42-
43-
4420
/**
45-
* Compile scss as compressed css.
21+
* Compile scss as compressed css
4622
*/
4723
gulp.task('style', function () {
48-
return gulp.src('./src/scss/*.scss')
24+
return gulp.src('./src/scss/layout.scss')
4925
.pipe(changed(conf_style_dest))
5026
.pipe(sass({'outputStyle': 'compressed'}))
5127
.pipe(gulp.dest(conf_style_dest))
5228
.pipe(reload({stream:true}));
5329
});
5430

55-
5631
/**
57-
* Jade to html.
32+
* HTML
33+
* If the destination file has been changed, reload the page.
5834
*/
5935
gulp.task('templates', function () {
60-
return gulp.src('./src/jade/*.jade')
61-
.pipe(jade({
62-
'pretty': true,
63-
'locals': database
64-
}))
65-
.pipe(gulp.dest(conf_template_dest))
36+
return gulp.src('./src/html/**')
37+
.pipe(gulp.dest(conf_output_dest))
6638
.pipe(reload({stream:true}));
6739
});
6840

69-
7041
/**
7142
* Move images.
7243
*/
7344
gulp.task('images', function () {
74-
gulp.src('./src/img/**')
75-
.pipe(gulp.dest(conf_image_dest));
76-
});
77-
78-
79-
/**
80-
* Move bower components.
81-
*/
82-
gulp.task('bower', function () {
83-
gulp.src('./src/bower_components/**')
84-
.pipe(gulp.dest(conf_bower_dest));
45+
return gulp.src('./src/img/**')
46+
.pipe(gulp.dest(conf_image_dest))
47+
.pipe(reload({stream:true}));
8548
});
8649

87-
8850
/**
8951
* Compress javascript.
9052
*/
9153
gulp.task('scripts', function () {
92-
return gulp.src('./src/js/*.js')
54+
return gulp.src('./src/js/**')
9355
.pipe(changed(conf_script_dest))
9456
.pipe(uglify())
9557
.pipe(gulp.dest(conf_script_dest))
9658
.pipe(reload({stream:true}));
9759

9860
});
9961

100-
10162
/**
102-
* All build tasks.
63+
* Start a proxy server
10364
*/
104-
gulp.task('build', ['style', 'templates', 'images', 'bower', 'scripts']);
105-
65+
gulp.task('server', function() {
66+
browsersync({proxy: conf_url_dest});
67+
})
10668

10769
/**
108-
* Watch for chaned files
70+
* Watch for changed files
10971
*/
110-
gulp.task('watch', ['build'], function () {
111-
browsersync({
112-
proxy: conf_url_dest
72+
gulp.task('watch', function () {
73+
// watch for files that were changed
74+
gulp.watch('./src/scss/**/*.scss', ['style']);
75+
gulp.watch('./src/html/**/*.html', ['templates']);
76+
gulp.watch('./src/js/**/*.js', ['scripts']);
77+
// watch for files that are added
78+
gulpwatch('./src/img/**', function () {
79+
gulp.src('./src/img/**')
80+
.pipe(gulp.dest(conf_image_dest))
81+
.pipe(reload({stream:true}));
82+
});
83+
gulpwatch('./src/js/**', function () {
84+
gulp.src('./src/js/**')
85+
.pipe(gulp.dest(conf_script_dest))
86+
.pipe(reload({stream:true}));
11387
});
114-
gulp.watch('./src/scss/*.scss', ['style']);
115-
gulp.watch('./src/jade/**/*.jade', ['templates']);
116-
gulp.watch('./src/js/*.js', ['scripts']);
117-
gulp.watch('./src/db/database.json', ['clean', 'build']);
118-
gulp.watch('./dist/*html').on('change', reload);
11988
gulputil.log(gulputil.colors.inverse("Shazam! We're up and running."));
12089
});
12190

122-
12391
/**
12492
* Default task
12593
*/
126-
gulp.task('default', function () {
127-
if (clean === true) {
128-
gulp.start(['clean']);
129-
} else {
130-
gulp.start(['watch']);
131-
}
94+
gulp.task('default', ['style', 'templates', 'images', 'scripts', 'server', 'watch'], function () {
95+
// Start all tasks
13296
});

0 commit comments

Comments
 (0)