Open ClaudiuCreanga opened 7 years ago
Did you find any solution to the sourcemaps not generated? EDIT: It happens to be the locales being different from the themes.js grunt config and the one set in back-office.
@ClaudiuCreanga @gillesMifsud I'm having the same problem with sourcemaps not generating on Magento 2.1.9. Is there a way to solve this? Thanks!
@ClaudiuCreanga make sure you target the same locale theme. The grunt config file themes.js
locale and grunt php bin/magento dev:source-theme:deploy --type="less" --locale="fr_FR" --area="frontend" --theme="Vendor/theme"
and you cleaned everything rm -rf var/di/* generated/code/* var/generation/* var/cache/* var/log/* var/page_cache/* var/session/* var/view_preprocessed/* pub/static/*
and cache flush before this.
Can we confirm please if this is an issue with 2.1.9? Im having the same issue. No source maps generated for CSS files. Tried all the steps above. Grub exec: Seems to complete without issue, my themes.js contains this
jarvis: { area: 'frontend', name: 'Vicomage/jarvis2', locale: 'en_AU', files: [ 'css/styles-m', 'css/styles-l' ], dsl: 'less' },
Im running the following command php bin/magento dev:source-theme:deploy --type="less" --locale="en_AU" --area="frontend" --theme="Vicomage/jarvis2"
and have cleared all caches etc.
When I try to find and .map files, all I find is javascript map files
What is the commit number of this fix in v.2.3 ?
Hope, not in 2.3, feature freeze. @ihurskyi 2.4 for sure, I have uglified js with sourcem aps in production as well as SASS post-processed. Have to find time to wrap it up so it can be part of core. Bundling does not work as good as I want.
FYI this will require people to have nodejs/NPM as part of ordinary setup, and far deom
Question for once who want it in 2.3.x there is a way to put it in the core. If node parts are found that are needed to make things work. Will use default behavior if nothing found. Who is ready to fill this gap June 12,16?
When using grunt less, and in themes.js the sourceMap: true,
is set.
Looking in the inspector i see a map, but link to the less file is not found (404)
Now the possible problem is that the magento2 public link is in /pub/ and the magento files in /. The link of the _[filename].less is going to /pub/static/ instead of /static/ So removing in the url the /pub/ part, shows the good less file.
In dev/tools/grunt/configs/themes.js
can be found sourceMapRootpath: '/',
Changing this with like /fooman/
changes the url to /fooman/pub/static/
Trying /../
does not work. It looks like the link will be ignored.
When setting your apache or nginx public link is set to the magento root, then the links works, because it loads /pub/static/frontend
(and so on)
@Krielkip a workaround to this is to add outputSourceFiles: true,
to the options config. That is:
options: {
outputSourceFiles: true,
sourceMap: true,
strictImports: false,
sourceMapRootpath: '/',
dumpLineNumbers: false, // use 'comments' instead false to output line comments for source
ieCompat: false
},
@le0n4eg not working for me
I also didn't have source maps by just running grunt watch
, but if I first run grunt less:mytheme
they appear.
I am not sure if map files are later updated on each change with grunt watch
running ...
Is there an update for this? I am using Magento 2.3.4 and style-m.css and styles-l.css are still showing in the browser.
I finally figured it out. The sourcemaps where generated correctly, but in the wrong folder, since I configured my theme incorrectly in dev/tools/grunt/configs/local-themes.js:
Before:
module.exports = {
company_base: {
area: 'frontend',
name: 'Company/Base',
locale: 'de_DE',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
},
};
After:
module.exports = {
company_base: {
area: 'frontend',
name: 'company/base', // <-- I had to change it to lower case
locale: 'de_DE',
files: [
'css/styles-m',
'css/styles-l'
],
dsl: 'less'
},
};
Open the file registration.php of your theme and check your path:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use \Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/company/base', __DIR__);
As you cans see I used company/base but in my local-theme.js I used Company/Base as name.
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1048 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
+1 for any update on this
No source maps are being generated by grunt.
Preconditions
Steps to reproduce
Expected result
Actual result