bminer / node-blade

Blade - HTML Template Compiler, inspired by Jade & Haml
Other
320 stars 28 forks source link

Bundle blade for Atmosphere smart package repository #88

Closed badslug closed 12 years ago

badslug commented 12 years ago

It would be convenient to package and submit blade to the Atmosphere smart package repository

https://atmosphere.meteor.com

See the "WTF¿" tab, "Building a smart package" page for how. This would make including blade in Meteorite projects a single dependency line (like npm dependencies).

bminer commented 12 years ago

Agreed. This is definitely on my radar screen.

crapthings commented 12 years ago

awesome, can't wait. + 1

bminer commented 12 years ago

@IainShigeoka - suppose I include a smart.json file in my Github repo. How does Atmosphere "know" where the Meteor package files are in my Github repo? Does it search the repo for a package.js file?

bminer commented 12 years ago

For example, the meteor-validation package has a package.js file in lib/validation, not in the root directory of the repository.

badslug commented 12 years ago

Hmm. I'm not sure. I've only created smart packages where the smart.json and package.js files are in the project root. @possibilities or @tmeasday would be the people who know... hopefully they'll see their mention and respond.

possibilities commented 12 years ago

mrt expects smart.json to be in the repo root and searches the tree for a package.js to determine the smart package root. smart, eh? (;

bminer commented 12 years ago

@possibilities - smart, indeed. Thanks for the response!

bminer commented 12 years ago

@possibilities - What about using require() within my package.js file? Meteor "overrides" the require function with its own, which prevents me from including my code.

Previously, I did something like var blade = require('../../packages/blade/node_modules/blade'); instead of simply var blade = require('blade'); since paths had to be relative to app/lib/packages.js (since that's the file that evals the package.js file)

Now I have code like this...

try {
    blade = require('blade')
}
catch(e) {
    try {
        //XXX super lame! we actually have to give paths relative to
        // app/lib/packages.js, since that's who's evaling us.
        // The next line is for the core Meteor-installed package
        blade = require('../../packages/blade/node_modules/blade');
    }
    catch(e) {
        //XXX super lame! The next line is for the Meteorite-installed package
        blade = require(process.cwd() + "/.meteor/meteorite/packages/blade/node_modules/blade");
    }
}
//-- end of horrible hack

Is there any way around this?!?!