0

I have started using Grunt, but encountered an issue. I am trying to change styles in custom theme via one of the LESS files, but nothing happens. It worked once, but it doesn't now, and I don't know why.

Task: change _grid-col.less
Result expected: style change on front-end.
Current result: style changes on front-end from an earlier customization (but not from the last).

Here's what I've tried:

  • Set Magento Dev mode;
  • clear directories var/di/, var/generation/, /var/view_preprocessed/, , /pub/static/frontend/Codazon/
  • flush cache
  • change _grid-col.less
  • grunt clean:outdoor
  • grunt exec:outdoor
  • grunt less:outdoor --force (force because the theme has some errors. That didn't prevent it from working earlier...)

Also, I tried:
- setup:static-content:deploy --theme Codazon/fastest_outdoor lt_LT en_GB
- clear browser cache

Here is my themes.js file for Grunt:

    module.exports = {
    outdoorlt: {
       area: 'frontend',
        name: 'Codazon/fastest_outdoor',
        locale: 'lt_LT',
        files: [
            'css/source/_theme',
            'css/source/_variables',
            'css/source/layout/_blocksidebar',
            'css/source/layout/_footer',
            'css/source/layout/_header',
            'css/source/layout/_slider',
            'css/source/layout/_homestore',
            'css/email-fonts',
          'css/source/components/_modals_extend',
            'css/source/_sources'
        ],
        dsl: 'less'
    },
    outdoor: {
       area: 'frontend',
        name: 'Codazon/fastest_outdoor',
        locale: 'en_GB',
        files: [
            'css/source/_theme',
            'css/source/_variables',
            'css/source/layout/_blocksidebar',
            'css/source/layout/_footer',
            'css/source/layout/_header',
            'css/source/layout/_slider',
            'css/source/layout/_homestore',
            'css/email-fonts',
            'css/source/components/_modals_extend',
            'css/source/_sources'
        ],
        dsl: 'less'
    }
};

'css/email-fonts', 'css/source/components/_modals_extend', 'css/source/_sources' are from parent theme. _grid-col.less is imported via _sources.less

I recently changed the workflow to client-side, but that didn't help.

2 Answers 2

0

try the following:

The first you could try

  1. go to the backend under system-> cache management
  2. under additional cache management (the last section of this site) you have the point with the explaination: Themes JavaScript and CSS files combined to one file.
  3. press the button
  4. use the cpmposer with the compile commands

    • -d memory_limit=-1 bin/magento setup:static-content:deploy en_US

    • bin/magento index:reindex

    • bin/magento cache:clean

The second you could try

use the cpmposer with the compile commands

  • -d memory_limit=-1 bin/magento setup:di:compile
  • -d memory_limit=-1 bin/magento setup:static-content:deploy en_US
  • bin/magento index:reindex
  • bin/magento cache:clean
3
  • Thank you for your help, but I haven't achieved any changes with these solutions. The composer commands you provided have bad syntax. I am quite new to Magento maybe I have mistaken. Anyway, it's strange that when I delete pub/static/frontend/Codazon content and refresh website, it uses pub/static/frontend/Codazon/fastest_outdoor/en_GB/css/styles-l.css which doesn't exist on server.
    – Gediminas
    Nov 19, 2016 at 19:27
  • Where is the bad syntax? And with your problem with your less file:
    – Irv
    Nov 23, 2016 at 13:31
  • Im sorry, forgot the last part: It use the cached file or the theme-file. Did you look at the vendor folder?
    – Irv
    Nov 23, 2016 at 13:34
0

Finally, I found that it was Varnish what stopped from cleaning cache. When my webserver started using more hosts, Varnish purge wouldn't work with Magento flush. I had to change some settings in default.vcl. In my case, I added set req.http.host = "outpro.lt";

More details https://stackoverflow.com/questions/3334023/configure-multiple-sites-with-varnish

In addition, I have changed Varnish settings in Magento, default.vcl and /etc/sysconfig/varnish host or listen address (according to file) to my host instead of IP.

UPDATE

It does not work as supposed to.. Anyway, running command service varnish restart always cleans the cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.