Skip to content

Commit

Permalink
feat(generators): add Sass import reminder to page generator
Browse files Browse the repository at this point in the history
  • Loading branch information
tlancina committed Feb 16, 2016
1 parent 84cf9ce commit b22b5ff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tooling/generators/page/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var path = require('path'),
fs = require('fs'),
Generator = require('../../generator');

module.exports = PageGenerator;
Expand All @@ -11,4 +12,25 @@ function PageGenerator(options) {

PageGenerator.prototype = Object.create(Generator.prototype);

Generator.prototype.renderTemplates = function renderTemplates() {
var templates = this.loadTemplates();
var scssPath = null;

templates.forEach(function(template) {
var renderedTemplate = this.renderTemplate(template);
var renderedTemplateDest = path.join(this.appDirectory, 'app', this.directory, this.fileName, this.fileName + template.extension);
if (template.extension === '.scss') {
scssName = this.fileName + template.extension;
scssPath = renderedTemplateDest;
}
console.log('√ Create'.blue, path.relative(this.appDirectory, renderedTemplateDest));
fs.writeFileSync(renderedTemplateDest, renderedTemplate);
}, this);

console.log(('\nDon\'t forget to add an import for ' + scssName + ' ' + 'in ' +
path.join('app', 'themes', 'app.core.scss') + ':\n\n @import ' +
path.relative(path.join(this.appDirectory, 'app', 'themes'), scssPath) +
'\n').green);
}


0 comments on commit b22b5ff

Please sign in to comment.