ft-interactive / generator-ftnewsapp

0 stars 0 forks source link

Browseify require paths #6

Closed kavanagh closed 10 years ago

kavanagh commented 10 years ago
var iframeUtils = require('../bower_components/ig-utils/js/iframe-utils');

Given the above line would it be better to somehow let Browserify workout that ig-utils is in bower_components? So we'd have...

var iframeUtils = require('ig-utils/js/iframe-utils');
callumlocke commented 10 years ago

Yes I agree with this. The debowerify transform does this.

However it relies on each component's bower.json pointing at a single "main" script for that component.

This basically means we need to separate the iframe-utils and handlebars-utils into different repos. Personally I think this would be a good move anyway, since these modules aren't co-dependant and they're not really related, other than being "smallish things we use a lot".

If we do this, then it becomes even nicer:

var iframeUtils = require('ft-iframe-utils');

If you agree, please create the 2 repos (ft-iframe-utils and ft-handlebars-utils, or ig-*..?) and give me push access and I'll do the rest.

callumlocke commented 10 years ago

OK I've added debowerify, and it turns out it does work fine with pulling out specific files from inside components (eg var iframeUtils = require('ig-utils/js/iframe-utils');).

I still think it would be good to separate out those two components into different repos though.

kavanagh commented 10 years ago

Cool. Let's just keep that for now. Let's think about splitting out later.

The idea of ig-utils is for miscellaneous utilities that are not big enough to be their own libs yet. As a developer you'd just want to get all the misc utils at the beginning of the project cos you don't know which you'll use. There is no deps between them so you can just pull i the utils you need (not the whole thing).