Skip to content

Commit

Permalink
deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Jul 17, 2018
1 parent a9122a3 commit 7928036
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/moon-mvl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ const Moon = require("moon");
module.exports = function(file, contents) {
let js = "import Moon from \"moon\";";
let css = "";
let dep;
let deps = [];

const view = "function(m,instance,locals){" + Moon.compile(this.contents) + "};";
let data = "{};";

const fileName = path.basename(file).slice(0, -4);
const directoryName = path.dirname(file);
if (fs.existsSync(path.join(directoryName, fileName + ".js"))) {
dep = `.${path.sep}${fileName}.js`;
const dep = `.${path.sep}${fileName}.js`;
deps.push(dep);
js += `import data from "${dep}";`;
data = "data;";
}
Expand All @@ -23,6 +24,6 @@ module.exports = function(file, contents) {
return {
js: js,
css: css,
dep: dep
deps: deps
};
};

0 comments on commit 7928036

Please sign in to comment.