I come here because I’ve got a problem with the sass plugin. It’s not working despite the fact that I feel like I’ve done everything required.
- ‘scssphp’ folder is inside ‘plugins’ Kirby’s folder.
- 'scss.php’ is inside ‘snippets’ Kirby’s folder.
- The SCSS snippet <?php snippet('scss') ?> is in my HTML head.
- There is a folder ‘scss’ inside Kirby’s assets folder.
- I’ve created a file ‘default.scss’ and place it inside ‘assets/scss’.
- The folder ‘assets/css’ exists on the server.
- I added c::set(‘scssNestedCheck’, true); to the config. (The site/config/config.php file, right ?)
Then. How do I call the scss file in the page ? Like a normal css file, by its url ? Or do I have to link to an .css with the same name that the .scss file, and the plugin understand that in fact, it has to transform the scss to css ? But in that case, should all the css/scss rules be in the .scss file or the .css ?
I’m a bit lost, on surely, the easiest part, but since it’s not described in the doc I can’t really figure out what I’m doing wrong.
Thanks in advance : )
According to the docs, the plugin should actually compile the SASS files to a default.css file in
This is then the file you have to include in the head of your project:
<?= css('assets/css/default.css') ?>
Ok, thanks, i’m going to try this right now. : ) two last newbie questions, does this mean that I have to already create an empty default.css ? & Can I change the “default” name by something else without modify the plugin itself ?
I’m not quite sure, the documentation says it will overwrite an existing file, but I would assume that it created a new file if it doesn’t exist yet.
Hi again !
So, I’ve tried once more, and it still don’t work
The sass file is not compiled. If i check in the browser the default.css file, it’s empty.
Is it a problem from the server itself ?
Maybe a problem with permissions or ownership so that the file can’t be written? I have never used the plugin, so it’s hard to tell. I’ll invite the developer to this discussion.
I know this is not answering your question, but why don’t you “compile” the sass-files locally using grunt or gulp? What’s the advantage of doing this with php on your server?
I can confirm, if you have done the steps 1 to 7 in your initial post, this would run.
So I agree that this is:
I guess, that your webserver can not write in the directory “
\assets\css\”. I recommend to check this, possibly with the hoster.
What is your PHP version?
What your KIrby version?
Which webserver are you using?
What is his OS?
I use this solution since Jun 3 to implement my strategy HowTo: Start Kirby development on a PC.