Skip to content

Commit

Permalink
Added browser sync to go along with docs while developing
Browse files Browse the repository at this point in the history
  • Loading branch information
renatodeleao committed Feb 22, 2019
1 parent 198b388 commit 1eb6362
Show file tree
Hide file tree
Showing 4 changed files with 758 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ indent_size = 2
indent_style = space
indent_size = 3

[*.{json,yml}]
indent_style = space
indent_size = 2

# 4 space indentation
# [*.py]
# indent_style = space
Expand Down
37 changes: 29 additions & 8 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import del from "del";
import cssnano from "cssnano";
import sassdoc from "sassdoc"
import moduleImporter from 'sass-module-importer';
import browserSync from 'browser-sync';


const server = browserSync.create();
const paths = {
scss: {
src: "./scss",
Expand All @@ -35,7 +36,7 @@ function build(cb){
cssnano()
];

return src(`${paths.scss.src}/qnorr.scss`)
return src(`${paths.scss.src}/qnorr.scss`, { since: lastRun(build) })
.pipe(sourcemaps.init())
.pipe(scss({
importer: moduleImporter()
Expand All @@ -48,22 +49,42 @@ function build(cb){
.pipe(dest(paths.scss.dest))
}

export function sassDocs() {
export function sassDocs(done) {
const options = {
dest: 'docs',
verbose: true,
//theme: "flippant"
};
const stream = sassdoc(options);

src(`${paths.scss.src}/**/*.scss`)
.pipe(stream)
.on('end', function () {
console.log('End of parsing phase');
});

return src(`${paths.scss.src}/**/*.scss`)
.pipe(sassdoc(options));
return stream.promise.then(function () {
console.log('End of documentation process');
});
}

function reload(done) {
server.reload();
done();
}

function serve(done) {
server.init({
server: {
baseDir: paths.docs.dest
}
});
done();
}

export function watching() {
watch(`${paths.scss.src}/**/*.scss`, parallel(build, sassDocs));
watch(`${paths.scss.src}/**/*.scss`, series(build, sassDocs, reload));
}

exports["dev"] = series(cleanDocs, clean, build, sassDocs, watching);
export default series(clean, build);
exports["dev"] = series(cleanDocs, clean, build, sassDocs, serve, watching);
export default series(clean, build, sassDocs);
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
],
"main": "dist/qnorr.css",
"style": "dist/qnorr.css",
"files": [
"dist/*.{css,map}",
"scss/**/*.scss"
],
"scripts": {
"dev": "node-sass -w --output-style expanded --source-map true --source-map-contents true --precision 6 scss/qnorr.scss dist/qnorr.css",
"build": "yarn run clean:dist && yarn run preprocess && yarn run postprocess",
Expand All @@ -36,6 +40,7 @@
"@babel/preset-env": "^7.3.1",
"@babel/register": "^7.0.0",
"autoprefixer": "^9.4.7",
"browser-sync": "^2.26.3",
"cssnano": "^4.1.8",
"del": "^3.0.0",
"gh-pages": "^2.0.1",
Expand Down
Loading

0 comments on commit 1eb6362

Please sign in to comment.