How to specify background image in global SASS stylesheet? Within the "src" folder I have a "sass" folder contain a stylesheet with the following:
background-image: url(../assets/test.jpg)
The "assets" folder is on the same level as the "sass" folder. I addition to the path above, I have also attempted using "./" and "../../" to no avail.
Error:
ERROR in ./src/assets/test.jpg 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
Calling import image from '../assets/test.jpg'
alone, without calling the file from within SASS also throws the error.
I believe I've discovered the cause of the problem; my include:
value is not properly configured. Currently, I have all of my media files located within this /assets/
folder, and so it seems they are all being compiled as .svg
files.
{
resolve: `gatsby-plugin-react-svg`,
options: {
rule: {
include: /assets/
}
}
}
Plugin issue is addressed at the bottom of its documentation. https://www.gatsbyjs.org/packages/gatsby-plugin-react-svg/?=gatsby-plugin-react-svg
Solved by renaming svg files and updating plugin settings include: /\.inline\.svg$/
.
gatsby-node.js
or use any plugins that might have done so? - Derek Nguyen