cancel
Showing results for 
Search instead for 
Did you mean: 

Static Content Deploy error after theme install

Static Content Deploy error after theme install

Hey guys, first time in the board but I'm setting up a webstore and after trying a theme now I can't deploy the static content for the default theme.

 

The error that it is presenting is:

 

 

Compilation from source: /home/xxxxx/public_html/vendor/magento/theme-frontend-blank/web/css/styles-m.less
variable @icon-edit is undefined in file /home/xxxxxxx/public_html/var/view_preprocessed/pub/static/frontend/Magento/luma/en_US/Magento_Checkout/css/source/module/_cart.less in _cart.less on line 254, column 21
252|                     top: 0;
253|                     .lib-icon-font(
254|                     @icon-edit,
255|                     @_icon-font-size: 18px,
256|                     @_icon-font-line-height: 20px,
257|                     @_icon-font-text-hide: true,

 

 

I also don't even use en_US but en_GB and pt_PT.

My main concern now is that it won't generate the styles-m.css for the Luma template. The Blank theme is ok with CSS working.

 

Can please someone give an hand?

8 REPLIES 8

Re: Static Content Deploy error after theme install

Hi @marcelo_martins.

I have fixed same type of error earlier.

You can try below solution.

Try once after adding undefined variable in your theme's _variable.less fine and declare there.

I managed to fix the problem, so static content is deployed. I had to add these to _variables.less (from luma theme) or _cart.less file

@icon-edit : true;

 I hope it will help you!

Re: Static Content Deploy error after theme install

Is it a bug of any kind?
Later today I’ll test out if the presented works.

 

EDIT:

Had to add more variables:

@icon-edit : true;
@icon-download : true;
@icon-private : true;
@icon-star-empty : true;
@copyright__background-color : true;

those were failing and I don't know why.

I've installed a free theme (from template monster) and didn't liked it. after removal those errors... now it's working at least...

 

Can't get why this happens...

Re: Static Content Deploy error after theme install

You will need to go to file having issue and replace the variable with true.
------------------------------------------------------------------------------------------------------
Use this command to open the file in edit mode.

sudo nano <path of file>

Now use ctrl+w to search "@icon_edit"

Once you get it, replace "@icon_edit" with true.
so the new code should look like.

252|                     top: 0;
253|                     .lib-icon-font(
254|                     true,
255|                     @_icon-font-size: 18px,
256|                     @_icon-font-line-height: 20px,
257|                     @_icon-font-text-hide: true,

Now use Ctrl+O to save the file.
And then Ctrl+E to exit from it.

Re: Static Content Deploy error after theme install

Sorry to revive this old post but I have this exact error and while there are instructions posted on how to resolve it, I am not sure it is leading me to a good place.

 

My error is: 

 

Compilation from source: /var/www/html/mysite/vendor/magento/theme-frontend-blank/web/css/styles-m.less
variable @icon-edit is undefined in file /var/www/html/mysite/var/view_preprocessed/pub/static/frontend/Magento/luma/en_AU/Magento_Checkout/css/source/module/_cart.less in _cart.less on line 254, column 21
252|                     top: 0;
253|                     .lib-icon-font(
254|                     @icon-edit,
255|                     @_icon-font-size: 18px,

 

I am using the Luma theme and it was all working well in developer mode but when I changed to production mode the css was all messed up. After changing back to developer mode I ran these commands.

 

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento c:f
php bin/magento c:c

All of the commands worked without error except the static content deploy which gives the error above.

 

 

I have changed the below entries to true as per the advice from @rvermasuit41ad but I am not sure why I am doing this and I feel it is just masking the issue.

 

I changed the entry in these files for @icon-edit.

 

vendor/magento/theme-frontend-luma/Magento_Checkout/web/css/source/module/_cart.less
vendor/magento/theme-frontend-luma/Magento_Checkout/web/css/source/module/_minicart.less
vendor/magento/theme-frontend-luma/Magento_GiftMessage/web/css/source/_module.less

@icon-download

 

 

vendor/magento/theme-frontend-luma/Magento_Downloadable/web/css/source/_module.less

@icon-private

vendor/magento/theme-frontend-luma/Magento_MultipleWishlist/web/css/source/_module.less

@icon-star-empty

vendor/magento/theme-frontend-luma/Magento_Review/web/css/source/_module.less

@copyright__background-color

vendor/magento/theme-frontend-luma/Magento_Theme/web/css/source/_module.less

 

Any ideas on what has gone wrong here. Is it possible to redownload/reinstall the default themes again?

Re: Static Content Deploy error after theme install

Update: I commented out the @icon-edit value in the below 2 files and it is now working again.

vendor/magento/theme-frontend-luma/Magento_Wishlist/web/css/source/_module.less
vendor/magento/theme-frontend-luma/Magento_Checkout/web/css/source/module/checkout/_shipping.less

I would still be very keen to hear from anyone about why this happened. Or where the @icon-edit value should be declared so I can invetigate further.

 

Magento version is 2.4.0. Will be performing an upgrade soon.

Re: Static Content Deploy error after theme install

@retrorag i am glad you were able to get out it.
Even i got into this but wasnt able to get out of it then i understood Magento need these variable but they haven't been assigned anywhere. So i managed this workaround and it working fine from the time i built it Smiley Very Happy.

If it helped you accept it as solution, it can save someone's time Smiley Happy

Re: Static Content Deploy error after theme install

I have solved this problem. This folder was empty.

vendor/magento/theme-frontend-luma/web

I copied files from a backup into the folder and undid all of the other changes I made and this fixed the problem.

I felt like the above solution was a band aid fix and did not resolve the underlying problem. I was also annoyed because the compare icon no longer displayed.

 

Re: Static Content Deploy error after theme install

I'm happy to hear that you were able to find a way out of it.
I, too, fell into this trap and struggled to escape until I realised that Magento relies on some unused variables. So, I figured out this workaround, and it has been functioning perfectly ever since I first constructed it.

If you were able to see it as a solution after reading this, perhaps it will help someone else out there.

 

Krowd Darden