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

templates directory per project #2

Open
livedata opened this issue Sep 12, 2012 · 0 comments
Open

templates directory per project #2

livedata opened this issue Sep 12, 2012 · 0 comments

Comments

@livedata
Copy link

A quick, and beautifull enhancement (;P) of a way that scaffold templates are generated. If 'YOUR_PROJECT/.templates' directory exists and template file exists inside, it will be used by scaffold generator instead of that default one from 'ejs-ext' templates directory.

exports.template = function (name) {                                                                                                                                                                                                            
    try {                                                                                                                                                                                                                                       
            stats = fs.lstatSync(process.cwd() + '/.templates/' + name + '.ejs');                                                                                                                                                                   

            if (stats.isFile()) {                                                                                                                                                                                                                   
                 return process.cwd() + '/.templates/' + name + '.ejs';                                                                                                                                                                              
            }                                                                                                                                                                                                                                       
    }                                                                                                                                                                                                                                           
    catch (e) {}                                                                                                                                                                                                                                

    return __dirname + '/templates/' + name + '.ejs';                                                                                                                                                                                           
}; 

Sorry that it is not a pull request, but i was enlightened in some place, where i'm unabe to do that ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants