Skip to content

Commit

Permalink
type: feat | added support for browser sync
Browse files Browse the repository at this point in the history
  • Loading branch information
mcqua007 committed Feb 25, 2021
1 parent a5b9ee8 commit e9ce826
Show file tree
Hide file tree
Showing 5 changed files with 3,289 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
*config.yml
*.env
*node_modules/
*theme.update
41 changes: 41 additions & 0 deletions bs-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
|--------------------------------------------------------------------------
| Browser-sync config file
|--------------------------------------------------------------------------
|
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
|
| There are more options than you see here, these are just the ones that are
| set internally. See the website for more info.
|
|
*/
const yaml = require('js-yaml');
const fs = require('fs');

try {
let fileData = fs.readFileSync('./dist/config.yml', 'utf8');
const themeConfig = yaml.safeLoad(fileData);

//development theme config
var id = themeConfig.development.theme_id;
var store = themeConfig.development.store;
} catch (e) {
console.log('\x1b[33m%s\x1b[0m', 'Could not read config.yml, Make Sure you have a config in ./dist/config.yml');
throw new Error(e);
}

module.exports = {
proxy: `https://${store}?preview_theme_id=${id}&pb=0&_fd=0`,
files: 'theme.update',
reloadDelay: 100,
snippetOptions: {
rule: {
match: /<head[^>]*>/i,
fn(snippet, match) {
return match + snippet;
}
}
}
};
Loading

0 comments on commit e9ce826

Please sign in to comment.