sebastianha / angular-bootstrap-checkbox

A checkbox for AngularJS styled to fit the Twitter Bootstrap standard design
MIT License
148 stars 66 forks source link

Move template to external file #8

Open snapjay opened 9 years ago

snapjay commented 9 years ago

Moved template to an external file to separate HTML from the JS e.g. I don't have the Glythicon installed so I need to use my own template Used the Bootstrap UI folder naming convention.

sebastianha commented 9 years ago

I also thought about externalizing the template but as far as I know this is a problem when minimizing / uglifying the code as the tools don't recognize the template and therefore do not include it. Or am I missing something?

One solution would be to include two versions, one with inline-template and one without. But then there has to be made a choice which version should be referenced as the main version in bower.json.

sebastianha commented 9 years ago

For one project I created a script doing this automatically ( https://gist.github.com/sebastianha/613e37aedfd99a1e9fa2 ) and I hooked it into pre-commit of git.

This could be a solution but then the bower.json decision is still open.

jrgleason commented 9 years ago

As far as I know minification is ok if you use html2js like the angular-ui project. Check out my fork I can create a pull this weekend if you can't figure it out. On Oct 29, 2014 4:00 AM, "Sebastian Hammerl" notifications@github.com wrote:

I also thought about externalizing the template but as far as I know this is a problem when minimizing / uglifying the code as the tools don't recognize the template and therefore do not include it. Or am I missing something?

One solution would be to include two versions, one with inline-template and one without. But then there has to be made a choice which version should be referenced as the main version in bower.json.

— Reply to this email directly or view it on GitHub https://github.com/sebastianha/angular-bootstrap-checkbox/pull/8#issuecomment-60885881 .

sebastianha commented 9 years ago

Thanks for the hint to html2js, this seems to be exactly what I was looking for! I will take a look at it.

jrgleason commented 9 years ago

Also allows you to use jade which I personally prefer :-) On Oct 29, 2014 8:16 AM, "Sebastian Hammerl" notifications@github.com wrote:

Thanks for the hint to html2js, this seems to be exactly what I was looking for! I will take a look at it.

— Reply to this email directly or view it on GitHub https://github.com/sebastianha/angular-bootstrap-checkbox/pull/8#issuecomment-60913302 .

snapjay commented 9 years ago

Yeah - The minification is more a function of grunt/gulp compiling process. It would be better to abstract the HTML from the JS.

I'd also say the same argument goes for abstracting the CSS you're including for the size attribute. Would be better for handle that thru the CSS not the JS e.g. <checkbox class="large" />

jrgleason commented 9 years ago

Yeah I agree that making the large etc attr is bad but prob another issue :-) On Oct 29, 2014 9:22 AM, "Dan Shreim" notifications@github.com wrote:

Yeah - The minification is more a function of grunt/gulp compiling process. It would be better to abstract the HTML from the JS.

I'd also say the same argument goes for abstracting the CSS you're including for the size attribute. Would be better for handle that thru the CSS not the JS e.g.

— Reply to this email directly or view it on GitHub https://github.com/sebastianha/angular-bootstrap-checkbox/pull/8#issuecomment-60922231 .