diff --git a/lib/utils.js b/lib/utils.js index 2495b06..2ee3a31 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -38,7 +38,7 @@ const productionPrivateDir = () => { return fs.realpathSync(meteorRoot + '/../'); }; -const privateDir = process.env.BUNDLE_PATH || process.env.APP_DIR || productionPrivateDir(); +const privateDir = process.env.BUNDLE_PATH || productionPrivateDir(); let ROOT = privateDir && path.join(privateDir, 'programs', 'server', 'assets', 'app'); @@ -147,13 +147,20 @@ Utils = { // Take a path to a SCSS file and compiles it to CSS with `node-sass`. toCSS: function(scss) { - if (!Package['chrisbutler:node-sass']) { + let sass; + let meteorMinorVersionPosition = 1; + let minorVersion = Meteor.release.split('.')[meteorMinorVersionPosition]; + // since meteor 1.3 we no longer need meteor hacks just use the npm version + if (minorVersion >= 3){ + sass = require('node-sass'); + } else if (!Package['chrisbutler:node-sass']) { + sass = Package['chrisbutler:node-sass'].sass; + } else { Utils.Logger.warn('Sass support is opt-in since lookback:emails@0.5.0. Please add chrisbutler:node-sass from Atmosphere and try again.', TAG); return Utils.readFile(scss); } const file = path.join(ROOT, scss); - const sass = Package['chrisbutler:node-sass'].sass; try { return sass.renderSync({ diff --git a/package.js b/package.js index 2b40cd0..0f08e97 100644 --- a/package.js +++ b/package.js @@ -4,12 +4,13 @@ var where = 'server'; Package.describe({ name: 'lookback:emails', summary: 'Send HTML emails with server side Blaze templates. Preview and debug in the browser.', - version: '0.7.4', + version: '0.7.5', git: 'https://github.com/lookback/meteor-emails.git' }); Npm.depends({ - 'html-to-text': '1.3.0' + 'html-to-text': '1.3.0', + 'node-sass': '3.8.0' }); Package.onUse(function(api) {