Skip to content
This repository was archived by the owner on Jan 22, 2021. It is now read-only.

Updated for meteor 1.3 / 1.4 closes #71 #72

Merged
merged 4 commits into from Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Npm.require()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no more npm.require... its just require when npm is present.

} else if (!Package['chrisbutler:node-sass']) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be else if (Package['chrisbutler:node-sass'])?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno... again I'm on meteor 1.4 so if someone can test on a lower version it would be good. All I know is that this is working for us on 1.4. Tried to account for the other versions. BTW also working fine on galaxy.

sass = Package['chrisbutler:node-sass'].sass;
} else {
Utils.Logger.warn('Sass support is opt-in since lookback:[email protected]. 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({
Expand Down
5 changes: 3 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lookback-emails",
"version": "0.7.4",
"version": "0.7.5",
"description": "`lookback:emails` is a Meteor package that makes it easier to build, test and debug rich HTML emails.",
"repository": {
"type": "git",
Expand Down