cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable a Sourcemap for LESS?

How to enable a Sourcemap for LESS?

Hi, while playing around with Magento 2 to get familiar with its structure I noticed that I have no idea how to enable a sourcemap for LESS. For development I have set the compiler to client-side compilation.

 

With the previous version of Magento I always used Compass and enable the sourcemap in the config file.

 

Can somebody explain how it works in LESS specific for Magento 2?

 

Thank you in advance.

7 REPLIES 7

Re: How to enable a Sourcemap for LESS?

As I understand, there is no such possibility yet: https://mage2.pro/t/335

Re: How to enable a Sourcemap for LESS?

I found out that sourcemaps will be generated if you use grunt watch or grunt less:<theme>.

Check it out here how to configure it: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html

 

 

Re: How to enable a Sourcemap for LESS?

Hi tobiaswiking,

 

Thanks for this. I think that Grunt could be the way to go. Guess that i'm to attached to CodeKit and Sass ;-)

I'm going to play around with it and I will leave my thoughts about it in this thread.

 

Thanks again for pointing me into the right direction.

 

Cheers.

Re: How to enable a Sourcemap for LESS?

Happy to help!

 

When you are using Grunt, you don't need CodeKit.

Re: How to enable a Sourcemap for LESS?

i have installed grunt and tried to use it but... this is my output:

 

az@33:/var/www/mywebsite/web# grunt less:blank
Running "less:blank" (less) task
>> Destination pub/static/frontend/Magento/blank/en_US/css/styles-m.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/styles-l.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/email.css not written because no source files were found.
>> Destination pub/static/frontend/Magento/blank/en_US/css/email-inline.css not written because no source files were found.

Done, without errors.


Execution Time (2016-01-20 18:12:26 UTC)
loading tasks               174ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 70%
loading grunt-contrib-less   60ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 24%
less:blank                   12ms  ▇▇▇▇▇▇ 5%
Total 247ms

 

 

I have those: not written because no source files were found on every template. Any help?

Re: How to enable a Sourcemap for LESS?

Did you found the solution for this issue yet? I also get:

 

Destination pub/static/frontend/Magento/blank/en_US/css/styles-m.css not written because no source files were found.

Destination pub/static/frontend/Magento/blank/en_US/css/styles-l.css not written because no source files were found....

 

And when I refresh the page it doesn't load these css files.

 

Please, help.

Re: How to enable a Sourcemap for LESS?

You need to run grunt exec:[themename] first.

For example grunt exec:blank, then grunt less:blank.