I have created a lightning component to house a very standard Bootstrap Navbar. We are also using the Koa template. I have tested the navbar and everyhting looks great in the dev console preview and even in Community Builder. But when I publish the site with the new Nav Bar component it loses all of its styling. Anyone have any ideas why this would happen? I am using the correct lightning require tags, like I said everything looks great until publication.
Best Answer
Take a look at loading external js and CSS in lightning:
https://developer.salesforce.com/blogs/developer-relations/2015/05/loading-external-js-css-libraries-lightning-components.html
Updated component code:
The styling in community is still a little off, the app.css is changing font style and bold attributes. I have no issues getting the file, one thing I found was the tool does not take the min version, I provided https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css and was able to generate the CSS, when i provided the min version I get the application error too
Step 1 : I took the bootstrap css provided it to the namespace generator tool
https://bootstrap-namespacer.herokuapp.com/
Step 2: loaded the resulting css back into static resource.
Step 3: Wrapped my container div with another div where class="mycustomnamespace i provided for my css"
Bootstrap preview: https://getbootstrap.com/examples/navbar/ My community preview: