Skip to content

Commit

Permalink
feat: update browser sync to use latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
Juned Kazi committed Feb 13, 2020
1 parent e6f7b01 commit 0916991
Show file tree
Hide file tree
Showing 4 changed files with 834 additions and 393 deletions.
2 changes: 0 additions & 2 deletions bin/stencil-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

require('colors');

var Fs = require('fs');
var Program = require('commander');
var Path = require('path');
var ThemeConfig = require('../lib/theme-config');
var pkg = require('../package.json');
var themePath = process.cwd();
Expand Down
37 changes: 8 additions & 29 deletions bin/stencil-start
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node

var _ = require('lodash');
var Bs = require('browser-sync').create();
var Cycles = require('../lib/cycles');
var recursiveRead = require('recursive-readdir');
Expand Down Expand Up @@ -92,7 +91,7 @@ if (!(dotStencilFile.normalStoreUrl) || !(dotStencilFile.customLayouts)) {
}

headers = {
'stencil-cli': Pkg.version
'stencil-cli': Pkg.version,
};

if (dotStencilFile.staplerUrl) {
Expand Down Expand Up @@ -131,12 +130,12 @@ Wreck.get(
if (configuration.jspm && Program.test) {
bundleTask = JspmAssembler.assemble(
{
bootstrap: configuration.jspm.bootstrap
bootstrap: configuration.jspm.bootstrap,
},
themePath
);

bundleTask(function (result) {
bundleTask(function () {
return startServer();
});
} else {
Expand All @@ -159,7 +158,7 @@ function startServer() {
themePath: themePath,
};

Server(params, function (err) {
Server(params, err => {
var watchFiles = [
'/assets',
'/templates',
Expand All @@ -181,7 +180,7 @@ function startServer() {
// Watch sccs directory and automatically reload all css files if a file changes
Bs.watch(Path.join(themePath, 'assets/scss'), event => {
if (event === 'change') {
Bs.reload(`stencil/*.css`);
Bs.reload('*.css');
}
});

Expand Down Expand Up @@ -250,38 +249,18 @@ function startServer() {
}
}

/**
* Convenience function to parse Theme Config and set some default values if they aren't present
*
* @return object
*/
function parseThemeConfig() {
var ret = {},
themeConfig;

themeConfig = ThemeConfig.getInstance(themePath, Program.variation);

try {
ret.config = themeConfig.getConfig();
} catch (e) {
return console.error(e);
}

return ret;
}

/**
* Assembles all the needed templates and resolves their partials.
* @param {string} templatePath
* @param {function} callback
*/
function assembleTemplates(templatePath, callback) {
recursiveRead(templatePath, ['!*.html'], function (err, files) {
recursiveRead(templatePath, ['!*.html'], (err, files) => {
files = files.map(function (file) {
return file.replace(templatePath + Path.sep, '').replace('.html', '');
});

Async.map(files, templateAssembler.assemble.bind(null, templatePath), function (err, results) {
Async.map(files, templateAssembler.assemble.bind(null, templatePath), (err, results) => {
if (err) {
callback(err);
}
Expand Down Expand Up @@ -309,7 +288,7 @@ function fileExist(path) {
* @return {string}
*/
function startUpInformation() {
var information = '\n';
let information = '\n';

information += '-----------------Startup Information-------------\n'.gray;
information += '\n';
Expand Down
Loading

0 comments on commit 0916991

Please sign in to comment.