mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixes #50 Ensure that all instances of marko have hot-reload and browser-refresh enabled
This commit is contained in:
parent
bbff5422cf
commit
dc5aa43e02
@ -12,6 +12,10 @@ exports.enable = function() {
|
||||
|
||||
enabled = true;
|
||||
|
||||
// We set an environment variable so that _all_ marko modules
|
||||
// installed in the project will have browser refresh enabled.
|
||||
process.env.MARKO_BROWSER_REFRESH = 'true';
|
||||
|
||||
var hotReload = require('../hot-reload');
|
||||
hotReload.enable();
|
||||
|
||||
|
||||
@ -11,12 +11,16 @@ var modifiedFlag = 1;
|
||||
exports.enable = function() {
|
||||
|
||||
|
||||
if (runtime.__browserRefresh) {
|
||||
if (runtime.__hotReloadEnabled) {
|
||||
// Marko has already been monkey-patched. Nothing to do!
|
||||
return;
|
||||
}
|
||||
|
||||
runtime.__browserRefresh = true;
|
||||
runtime.__hotReloadEnabled = true;
|
||||
|
||||
// We set an environment variable so that _all_ marko modules
|
||||
// installed in the project will have hot reload enabled.
|
||||
process.env.MARKO_HOT_RELOAD = 'true';
|
||||
|
||||
// Patch the Template prototype to proxy all render methods...
|
||||
|
||||
|
||||
@ -4,6 +4,14 @@ var Module = require('module').Module;
|
||||
var markoCompiler = require('../compiler');
|
||||
var cwd = process.cwd();
|
||||
|
||||
if (process.env.hasOwnProperty('MARKO_HOT_RELOAD')) {
|
||||
require('../hot-reload').enable();
|
||||
}
|
||||
|
||||
if (process.env.hasOwnProperty('MARKO_BROWSER_REFRESH')) {
|
||||
require('../browser-refresh').enable();
|
||||
}
|
||||
|
||||
function loadSource(templatePath, compiledSrc) {
|
||||
var templateModulePath = templatePath + '.js';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user