Thanks for posting this. It fixed the problem for me, at least.
iāve applied the fix from @drew and itās better but not working as it should. when i run gulp
i get the source maps from bootstrap files but the reference line number is wrong. IE: <body>
element is referenced as sacaffolding.less:24
when it should be sacaffolding.less:27
. so itās off by 3 lines. but it gets the file right. but when using theme .less
files like _global.less
than the source maps reference completely the wrong file: IE: if i add background-color: red;
on <body>
in _global.less
the source map points to _grid.less:4
.
Any other possible fixes for this? @drewās fix didnāt work for me. Also I will add that having added fontawesome and slick.js via bower, in my console it shows the filename as font-awesome.css or slick.css depending on which one was installed via bower first.
Photo of my console below.
Just thought I would follow up again here. I tried doing a plain vanilla install just to make sure it wasnāt some configuration change I made. Here are the steps:
- Install WordPress
- Pull Sage
- npm install
- bower install
- Update assets/manifest.json with local url
- Run gulp && gulp watch
- Change a style via layouts/_header.less (in this case the background
of .banner) - Inspect it in chrome
- Hang head as source maps do not display the original less file
I badly need to get this working. I just started my first major project using sage and not roots and this is really causing me issues. Any help would be appreciated.
Perhaps this issue is the reason? All the partial less files do start with underscores. I have no clue.
Since Sage v8.10, thereās no more Sass sourcemap! Itās being generated inside dist > styles
. But, Web Inspector just sees main.css.
iāve noticed that my main.css file has the whole source map file at the bottom encoded with base64 in the sourceMappingURL
, and after that there is another sourceMappingURL
with the map file name. here is the file. after the minfied css there is a huge block of code. i ran it to base64 decode and realized it was the source map. itās on two sites iām working on now that use Sage 8.0.1 and i pulled the latest version of Sage (8.1.0.) and all have the same āissueā. so my question is: is this an issue or is this how itās supposed to be? i know that older Roots versions didnāt compile source maps like that and that the sourceMappingURL
only referenced the file name. i tried gulp
and gulp watch
and both have the same results. gulp --production
compiles normal minified styles without source maps (i presume this is expected because source maps are disabled on gulp --production
). iām on Windows 7 (64 bit), node 0.12.0, npm 2.6.0, bower 1.3.12, gulp 3.8.11. alsoā¦ donāt know if this is related in some way to this post.
Iām not seeing this on a project I am using Sage on. Last line is /*# sourceMappingURL=main.css.map */
with CSS above it in dist/main.css
.
Have you modified the gulpfile at all?
no. i didnāt modify the file at all on all the sites. i also have the line /*# sourceMappingURL=main.css.map */
but i just have one line before that but instead of the map file name reference i have the source map encoded. it looks like this: /*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjoz ... */
. iām also experiencing the issue with source maps not referencing the right file and line number that i posted on the topic i referenced on my first post.
Looks like itās not happening on the project Iām working on, but it is happening on a fresh Sage install. Now to investigate
Since this looks like an actual bug, Iāve opened it on Github: https://github.com/roots/sage/issues/1386
Hey all,
Iām investigating a fix that allows us to use csswring and still have correct sourcemap functionality. I need test data however. If you guys could please send me your stylesheets or reduced testcases either here or in a private message that will help to debug. Worst case scenario I just write my own css minifier and publish it lol.
hey @austin, i can send whatever you need. just to point out that i tried a new Sage (8.1.0) install with no edits in the styles. I just compiled the CSS and JS with no edits in .less
other than the default ones that Sage has (grid, brand ā¦). so i donāt think anything i do in the styles has any effect on the issue. here are the files (iāve uploaded both assets and dist folders). if you need anything else let me know. thnx for your help.
@ben has a fix here:
trying to debug. disabling pleeeaseās minification makes the sourcemap work as expected:
.pipe($.pleeease, {
minifier: false,
autoprefixer: {
browsers: [
'last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4',
'opera 12'
]
}
})
It seems to fix it but first delete the old source maps.
doesnāt work for meā¦ tried disabling pleeeaseās minification (with and without and deleting the old source maps). it does change how the issue behaves. iāve posted more details on the GitHub issue page.
Having same issue withe sage and lessā¦
Adding āminifier: false,ā doesnāt fix but let you inspect less files with wrong line numbersā¦
We really need help from Roots guys,
this is a very embarrassing issue.
Thanks
Weāre not embarrassed by Sage at all. In fact weāre all really proud of whatās been achieved. Sage brings together umpteen different tools (most with multiple additional dependencies) and modernises WordPress theme development in a way no other starter theme can.
As with any complex software it relies on a multitude of dependencies, so the trade off is you will occasionally get issues that canāt be resolved instantly. This doesnāt mean weāre not working on it. It just means that we havenāt had the time in amongst our full time jobs to fix it yet.
If you need source maps working instantly, just remove the gulp-pleeease task from the gulp file and handle prefixing yourself.
Sorry for my poor english I was only saying I am embarrassed for my work on CSSā¦
I was not saying you were embarrassed for for Sage!
I worked with roots for many projects so I know that you can be proud of Roots Sage Bedrock & coā¦
I understand you need time to fix bugs and answer issues.
I spent time trying to make this works without success and I just asked your help, simply because you built the app.
Anyone following this thread might also want to subscribe to notifications on https://github.com/roots/sage/issues/1386
Latest update: switching to pleeease 3.2.0 works for me