Skip to content

Commit ed616cc

Browse files
committed
using livereload and sass now
1 parent c6d36d8 commit ed616cc

File tree

8 files changed

+488
-42
lines changed

8 files changed

+488
-42
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ firebase serve
3030
- That will build it all and watch the css, img, and js assets.
3131
- Then you can load up `http://localhost:5000` in a browser. narf!
3232
`/src/index.js` is the main file you'll want to edit for functionality.
33+
- If you have the [LiveReload Chrome extension](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei) installed, it should do live css updates in your browser while gulp watch is running
3334

3435
## How To Add New Problems
3536
- Problems are at `/src/problems/*.js`

gulpfile.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const postcss = require('gulp-postcss');
1111
const autoprefixer = require('autoprefixer');
1212
const cssnano = require('cssnano');
1313
const svgo = require('gulp-svgo');
14+
const sass = require('gulp-sass');
15+
const livereload = require('gulp-livereload');
1416

1517
function conf() {
1618
const opts = {};
@@ -65,12 +67,14 @@ gulp.task('css', () => {
6567
autoprefixer({browsers: ['last 1 version']}),
6668
cssnano()
6769
];
68-
return gulp.src('./src/css/*.css')
70+
return gulp.src('./src/css/style.scss')
71+
.pipe(sass.sync().on('error', sass.logError))
6972
.pipe(postcss(plugins))
70-
.pipe(gulp.dest('./public/dist/css'));
73+
.pipe(gulp.dest('./public/dist/css'))
74+
.pipe(livereload());
7175
});
7276

73-
const cssWatcher = gulp.watch('src/css/*.css', ['css']);
77+
const cssWatcher = gulp.watch('src/css/**/*.scss', ['css']);
7478

7579
cssWatcher.on('change', event => {
7680
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
@@ -112,6 +116,7 @@ gulp.task('build', () => {
112116
return compile();
113117
});
114118
gulp.task('watch', () => {
119+
livereload.listen();
115120
return watch();
116121
});
117122

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
"babel-preset-latest": "^6.24.1",
6262
"browserify": "^14.1.0",
6363
"chai": "^3.5.0",
64+
"gulp-livereload": "^3.8.1",
65+
"gulp-sass": "^3.1.0",
6466
"gulp-svgo": "^1.0.3",
6567
"husky": "^0.13.3",
6668
"lint-staged": "^3.4.0",

public/dist/js/bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/dist/js/bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/css/lib/defaults.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* default stuff */
2+
body {
3+
margin: 0;
4+
}
5+
body, input, select, textarea {
6+
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Arial,sans-serif;
7+
font-size: 16pt;
8+
box-sizing: border-box;
9+
color: #222
10+
}
11+
12+
.monospace {
13+
font-family: Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;
14+
}
15+
16+
.hide-until-load {
17+
visibility: hidden;
18+
}

src/css/style.css renamed to src/css/style.scss

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,7 @@
22
/* My custom styles
33
========================================================================== */
44

5-
/* default stuff */
6-
body {
7-
margin: 0;
8-
}
9-
body, input, select, textarea {
10-
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Arial,sans-serif;
11-
font-size: 16pt;
12-
box-sizing: border-box;
13-
color: #222
14-
}
15-
16-
.monospace {
17-
font-family: Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;
18-
}
19-
20-
.hide-until-load {
21-
visibility: hidden;
22-
}
5+
@import 'lib/defaults';
236

247

258
/* grid elements */

0 commit comments

Comments
 (0)