I'm having issues compiling scss with relative paths.
Here is my file structure:
src/
├── css/
│ ├── bootstrap.scss
│ ├── main.scss
├── fonts/
│ ├── fonts.css
│ ├── font1.woff2
├── index.html
├── main.css /* Compiled css */
main.scss:
@import './bootstrap-init';
@import '../fonts/fonts';
fonts.css:
@font-face {
font-family: 'font1';
src: url('./font1.woff2') format('woff2');
}
If you look at my fonts.css
, src: url()
, the url is pointing to the right file which is src/fonts/font1.woff2
. However, after when its compiled to src/main.css
, src: url()
now points to src/font1.woff2
which does not exits.
A similar question asked here for LESS: LESS importing CSS and relative paths
I'm using sass CLI and this is what I have at the moment:
sass --watch css/main.scss main.css
How would I go about fixing this issue? I can replace my paths to always point from the root folder, but that doesn't seem like a good approach...