From da6a493d3b11008ea93ac95299b7e8a4e46fd8a5 Mon Sep 17 00:00:00 2001 From: Ramy Ben Aroya Date: Thu, 1 Jun 2017 19:23:08 +0300 Subject: [PATCH] fallback to bower_components/lightbox instead of bower_components/lightbox2 --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b7bf271..3c460e8 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,14 @@ module.exports = { }, included: function lightbox_included(app) { this._super.included.apply(this, arguments); - var lightboxPath = path.join(app.bowerDirectory, 'lightbox', 'dist'), - lightboxCssContent = fs.readFileSync(path.join(lightboxPath, 'css', 'lightbox.css'),'utf8'); + var lightboxPath = path.join(app.bowerDirectory, 'lightbox2', 'dist'); + var lightboxCssContent; + + if (!fs.existsSync(lightboxPath)) { + lightboxPath = path.join(app.bowerDirectory, 'lightbox', 'dist'); + } + + lightboxCssContent = fs.readFileSync(path.join(lightboxPath, 'css', 'lightbox.css'),'utf8'); lightboxCssContent = lightboxCssContent.replace(/\.\.\/images\//g, 'images/lightbox/'); fs.writeFileSync(path.join(lightboxPath, 'css', 'lightbox.processed.css'), lightboxCssContent); this.app.import(path.join(lightboxPath, 'js', 'lightbox.js'));