Editing Casper Theme CSS vs Code Injection

Hey all,

I’m going to make some drastic changes to the Casper theme, I’m editing files for layout changes, new partials, etc. It is all good.

However I had some problems with GULP while editing CSS files. Then I saw Code Injection section. Is Code Injection the recommended way to edit CSS? Is there any benefits to edit CSS files. I lean more into CSS editing, however happy to use Code Injection if for some reason it is recommended.

Thank you

You can create a custom.css file under theme > assets > file-name.css. You can add all the custom css you want there, just make sure you link it in your default.hbs header like so <link rel="stylesheet" type="text/css" href="{{asset "css/custom.css"}}" />. Make sure you ghost restart when you first create this file or if you make any changes to this file to see your changes

You can also use the code injection altough I wouldn’t recommend it.


Thanks a bunch for this, all other instructions I found in the forum failed to work, but this did!

Actually, it’s best to add the “link” code to “Settings > Code injection”; simpler and less likely to be overwritten, plus restart shouldn’t be neccessary then.

1 Like