DEV Community

Discussion on: Setup Phoenix with Svelte+Rollup

Collapse
 
joshnuss profile image
Joshua Nussbaum

Hi @akaibukai ,

It should work for CSS too.
The global.css is imported inside main.js, inside rollup.config.js the css gets written to app.css.

Are you importing app.css in your layout?
Take a look at the example project: github.com/joshnuss/phoenix_svelte...
Let me know if it's still now working for you.

Collapse
 
akaibukai profile image
akaibukai

Hi OP and thank you for such a quick reply!
Indeed, I tried your repo from scratch and it worked then I redo from scratch on my side, and the problem was that I was keeping an @import "./phoenix.css statement at the top of my global.css file.

If I remove that statement and for example either import it from the JS side (like we already did on main.js like so import "../css/global.css" or simply by copy/pasting its content.

Do you know if it's possible with Rollup to @import CSS files within CSS files?
I'll probably need this anyway because of other library having those kind of @import?

Again thank you for taking the time to answer..

Thread Thread
 
joshnuss profile image
Joshua Nussbaum • Edited

Happy to help :)

Try importing phoenix.css inside main.js:

import '../css/phoenix.css'
import '../css/global.css'

Alternatively, postcss-import might do it, though I haven't tried it myself.