diff --git a/lib/mailer.js b/lib/mailer.js index 5e4853a..856e9ba 100644 --- a/lib/mailer.js +++ b/lib/mailer.js @@ -25,6 +25,7 @@ const TAG = 'mailer'; export const Mailer = { settings: { silent: false, + silentRouteAdd: false, routePrefix: 'emails', baseUrl: process.env.ROOT_URL, testEmail: null, diff --git a/lib/routing.js b/lib/routing.js index 3897678..c7b6a15 100644 --- a/lib/routing.js +++ b/lib/routing.js @@ -148,7 +148,9 @@ export default function Routing(template, settings, render, compile) { const name = Utils.capitalizeFirstChar(template.name); const routeName = String(type + name); - Utils.Logger.info(`Add route: [${routeName}] at path ${path}`); + if (!settings.silentRouteAdd) { + Utils.Logger.info(`Add route: [${routeName}] at path ${path}`); + } Picker.route(path, (params, req, res) => action(req, res, params, template)); }); diff --git a/lib/template-helpers.js b/lib/template-helpers.js index 90329fb..edca9ae 100644 --- a/lib/template-helpers.js +++ b/lib/template-helpers.js @@ -1,5 +1,9 @@ import Utils from './utils'; +if (Package['ostrio:flow-router-extra']) { + FlowRouter = require('meteor/ostrio:flow-router-extra').FlowRouter; // this fork doesn't use a global scope +} + // # Template helpers // // Built-in template helpers. diff --git a/lib/utils.js b/lib/utils.js index 48e4402..c716a0f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,12 +2,14 @@ import fs from 'fs'; import Path from 'path'; -import { htmlToText } from 'meteor/lookback:html-to-text'; +var htmlToText = Npm.require('html-to-text'); +var juice = Npm.require('juice'); const isDevEnv = process.env.NODE_ENV === 'development'; +const majorVersion = parseInt(Meteor.release.split('.')[0], 10); const minorVersion = parseInt(Meteor.release.split('.')[1], 10); -const isModernMeteor = minorVersion >= 3; +const isModernMeteor = majorVersion > 1 || minorVersion >= 3; // since meteor 1.3 we no longer need meteor hacks just use the npm version const sass = (function() { diff --git a/package.js b/package.js index 65c215b..8b81bb0 100644 --- a/package.js +++ b/package.js @@ -3,11 +3,16 @@ 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.7', + summary: 'Send HTML emails with server-side Blaze templates. Preview and debug in the browser.', + version: '0.7.8', git: 'https://github.com/lookback/meteor-emails.git' }); +Npm.depends({ + 'html-to-text': '4.0.0', + 'juice': '4.3.1' +}); + Package.onUse(function(api) { api.versionsFrom('1.0.4'); @@ -15,7 +20,9 @@ Package.onUse(function(api) { api.use([ 'chrisbutler:node-sass@3.2.0', 'iron:router@1.0.7', - 'kadira:flow-router@2.9.0' + 'kadira:flow-router@2.9.0', + 'staringatlights:flow-router', + 'ostrio:flow-router-extra' ], where, { weak: true }); api.use([ @@ -23,10 +30,8 @@ Package.onUse(function(api) { 'check', 'underscore', 'email', - 'sacha:juice@0.1.3', 'meteorhacks:ssr@2.2.0', - 'meteorhacks:picker@1.0.3', - 'lookback:html-to-text@2.1.3_2' + 'meteorhacks:picker@1.0.3' ], where); api.addFiles([ diff --git a/package.json b/package.json index 36cee74..6e2f2e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lookback-emails", - "version": "0.7.7", + "version": "0.7.8", "description": "`lookback:emails` is a Meteor package that makes it easier to build, test and debug rich HTML emails.", "repository": { "type": "git",