Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update addon for FastBoot 1.0 #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
33 changes: 28 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,43 @@
var fs = require('fs');
var path = require('path');
var Funnel = require('broccoli-funnel');
var Merge = require('broccoli-merge-trees');
var existsSync = require('exists-sync');
var fastbootTransform = require('fastboot-transform');

module.exports = {
name: 'ember-cli-photoswipe',

included: function(app) {
this.app = app;
var psDir = app.bowerDirectory + '/photoswipe';
app.import(psDir + '/dist/photoswipe.css');
app.import(psDir + '/dist/default-skin/default-skin.css');

if (!process.env.EMBER_CLI_FASTBOOT) {
app.import(psDir + '/dist/photoswipe.css');
app.import(psDir + '/dist/default-skin/default-skin.css');
app.import(psDir + '/dist/photoswipe.js');
app.import(psDir + '/dist/photoswipe-ui-default.min.js');
console.log(psDir);

Choose a reason for hiding this comment

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

This console.log probably should be removed before merging.

Copy link
Author

Choose a reason for hiding this comment

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

Aah good catch!

Copy link

Choose a reason for hiding this comment

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

@kratiahuja Seems a pitty this has gone no further? :)

app.import('vendor/photoswipe/photoswipe.js');
app.import('vendor/photoswipe/photoswipe-ui-default.min.js');
},

treeForVendor: function(tree) {
var trees = [];

if (tree) {
trees.push(tree);
}

var photoswipePath = path.join(this.app.bowerDirectory, 'photoswipe', 'dist');

if (existsSync(photoswipePath)) {
var photoSwipeTrees = fastbootTransform(new Funnel(photoswipePath, {
files: ['photoswipe.js', 'photoswipe-ui-default.min.js'],
destDir: 'photoswipe'
}));

trees.push(photoSwipeTrees);
}

return new Merge(trees);
},

treeForPublic: function() {
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
"author": "Daniel Ochoa <[email protected]>",
"license": "MIT",
"dependencies": {
"broccoli-funnel": "^0.2.3",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-babel": "^5.0.0",
"broccoli-funnel": "^0.2.3"
"exists-sync": "^0.0.4",
"fastboot-transform": "^0.1.0"
},
"devDependencies": {
"broccoli-asset-rev": "^2.0.2",
Expand Down
Loading