Having an issue when running yarn build:production.
I’m getting the error Module build failed: Unclosed block and it seems the error is occurring only when I have a background within a media query (If I remove the background, the build goes through). @media (min-width: 992px) {
.content__double {
background:url(’…/images/feature.jpg’);
}
}
feature.jpg can be found in assets/images/feature.jpg, is anyone else having this issue?
That sounds like it’s a syntax error in your CSS, like one bracket too many (or less). Check your code to see if there’s any blocks that are not properly closed off.
I thought that was the case, so I tried on another project.
Ran yarn build:production everything runs, no errors.
As soon as I try to call an asset image as a background within a media query … I’m presented with an error and the the command fails.
I’ve tried changing to background:#fff; and it works but changing to background:url(’…/images/feature.jpg’) 50% no-repeat; it fails. I will also note if I put that code outside of media query it will compile.
There must be an issue with the way media queries are being processed in your project… have you tried rm -rf node_modules/ && yarn install? Could be a bad dependency in your NPM cache which needs flushing out.
Still having the same issue, I thought it might of been a windows issue so I tried on a mac and get the same error.
Just so we can be on the same page, I’ve created a new project using 9.0.0-beta.2 and ran yarn build:production and everything worked. Once I add a background in a media query it breaks.
I’ve uploaded this test project to https://github.com/hubsta/sage , pull it and run yarn and than try to run yarn build:production and let me know if it completes. The only file I have changed is main.scss.
Wanted to jump on the bandwagon here. Sage 9.0.0-beta.2. Am seeing the same type of error - it is telling me it is dying on “background-image” but I’m not smart enough with sass to know if this is the same problem:
- name: Compile assets for production
command: yarn run build:production
connection: local
args:
chdir: "{{ project_local_path }}/web/app/themes/pillare"
to
- name: Compile assets for production
command: yarn run build
connection: local
args:
chdir: "{{ project_local_path }}/web/app/themes/pillare"
will work and deploy without issues. Obviously we’re making a tradeoff, but it also doesn’t seem gtmetrix hurt too bad:
I tried debugging this a bit and found that the source of the issue is bootstrap, precisely the navbar module of bootstrap.
After some digging I realised the cause of the problem is this variable in bootstrap: $navbar-inverse-toggler-bg: str-replace(url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='#{$navbar-inverse-color}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E"), "#", "%23") !default;
I usually do not include the whole bootstrap but just the modules I need, thus never really had this problem before, but I found this that might give you a better insight: