3

I want to use Bootstrap to create a NC theme.

I installed Bootstrap via Nugets Package Manager in Visual Studio 2013. Then i added :

Html.AppendScriptParts("~/Scripts/bootstrap.js"); Html.AppendScriptParts("~/Scripts/bootstrap.min.js");

in _Root.Head.cshtml

and

Html.AppendCssFileParts(string.Format("~/Content/bootstrap.css", themeName)); Html.AppendCssFileParts(string.Format("~/Content/bootstrap.min.css", themeName));

in Head.cshtml

Now its working for the half. I tried to play with a Bootstrap navbar, the navbar appears, but the dropdowns does not work. It seems that i miss some configuration for the .js files.

How can i get this the right way? Some help would be Greatly Appreciated.

Kdjave
  • 45
  • 3

1 Answers1

3

That's probably because you are adding the resources twice.

bootstrap.min.css is exactly the same code as bootstrap.css but it is the minified version of it. You usually use the non-minified version during development time (in order to make debugging easier), and then use the minified version in production (in order to make the file smaller in size and to provide some level of obfuscation).

Therefore, you need to include only one reference to each of the css and js files. That will be a total of two lines of code.

On another note, I see that you are working directly in the Scripts and Content folders. In nopCommerce, it is recommended to fork a custom theme and put all your modifications there. Get a better idea about this here. Also, take a look at others' efforts trying to develop a bootstrap-based theme in nopCommerce. You can start here.

romar
  • 804
  • 7
  • 17
  • Hi romar, that was exatly the problem, i removed the min files from my code and it's working now...I work in script and content folders because it's just a test project to play with Bootstrap. thanks a lot for solution and suggestions! – Kdjave Jan 20 '15 at 12:05