Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using SharePoint 2013 and I have created master page file (as .html) and converted it to .master file. As I have read, I should only modify html file, because all changes will be also registered in .master file and this doesn't work in opposite way.

I have also read, that I should keep css files and images in style library. The problem is, that all tutorials say that, but just for example, they are keeping those files in Master Pages folder. So I'm using:

<!--SPM:<SharePoint:CssRegistration Name="<% $SPUrl=~sitecollection/Style Library/MyCustomTheme/mycss.css%>" runat="server" After="corev15.css"/>-->

And this causes a problem on site: "An error occurred during translation of your HTML master page. For more information, please navigate to the master page by clicking the preview button in the Master Page Gallery or directly typing its URL".

If I'm not using SPUrl, but instead just a direct link to file, everything works fine, so there is no problem with CssRegistration - I don't know what's the issue here?

I also need to pack my custom design to .wsp file. When keeping all stuff in Master Pages folder, it can by done by Design Manager (automatically packs what's needed). If I keep some files in Style Library, will the Design Manager also pack them to solution?

share|improve this question
add comment

2 Answers 2

This issue caused by angle brackets "<" to fix it replace it with "&lt" as below:

<!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/css/style.css %&gt;" runat="server"  />-->
share|improve this answer
This is incorrect, the brackets and percents identifies an inline asp.net code! –  Robert Lindgren May 1 '13 at 13:42
@RobertLindgren Have you tried? –  Muawiyah Shannak Sep 22 '13 at 17:25
Multiple times. –  Robert Lindgren Sep 22 '13 at 17:29
@RobertLindgren, Anyway, I faced this issue before and i tried this solution (replace "<" with "&lt") , and it's work with me without any issues. –  Muawiyah Shannak Sep 24 '13 at 16:00
Same here. I tried this code and it worked. It's also mentioned here social.technet.microsoft.com/Forums/en-US/… –  Frank Martin May 13 at 7:35
show 2 more comments

i dont think your doing it properly!

<SharePoint:CssRegistration Name="<%$SPrl:~sitecollection/Style Library/MyCustomTheme/mycss.css%>" runat="server" After="corev15.css"/>

you were doing "<% $SPUrl=~ instead of "<%$SPrl:~




<SharePoint:CssRegistration Name="<% $SPUrl:~SiteCollection/Style Library/Core Styles/mycss.css%>" runat="server"/>

after digging around i found that most examples are storing their css in the core styles folder, i dont know why but they are, maybe you can add your custom folder to that folder. also you dont need After="corev15.css", well spotted loool I didnt notice the typo loooool, also make sure when you add the css to the hive folder that it has the correct permissions on the file and that you do an iisreset

so it would look like this if you add the folder:

<SharePoint:CssRegistration Name="<% $SPUrl:~SiteCollection/Style Library/Core Styles/MyCustomTheme/mycss.css%>" runat="server"/>
share|improve this answer
Sorry, I have made a typo there. I'm not using the sign of equality. But with spaces I have tried all combinations, because I have seen over the web all variations, as in: here or here. Obviously, there is a typo on msdn too, because it should be "SPUrl" not "SPrl". And as I said: I tried all combinations, even with "SPrl". –  Marcin Bigoraj Mar 4 '13 at 9:33
ammended my answer –  ali Sharepoint Mar 4 '13 at 9:46
Unfortunately, nothing of above works. I have also tried adding "~language" to expression and putting my file in "en-us" folder, but the error is the same. I have played with permissions, but also nothing helps. –  Marcin Bigoraj Mar 4 '13 at 15:57
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.