-2

I am updating a website from Drupal 7 to Drupal 8 and suddenly I see all these .less files influencing the style of the page. I found them in the theme's /srss directory (mytheme/srss/bootstrap/)

When I look at the current Drupal 7 version of the site, the navbar.less and navs.less files are not referenced.

On the Drupal 8 version of the site, I see navbar.less and navs.less styling the menu links. Turning off their attributes (in the browser only), specifically padding and margins, puts things back closer to where they are supposed to be.

Deleting or moving the _navbar.less and _navs.less files does nothing. Even after clearing the cache.

How do I remove or neutralize these *.less files from my site?

  • 1
    Browsers don't normally interpret .less files, they interpret CSS files which are compiled from those .less files. If you have sourcemaps, some browsers will use those to show you the .less files that originally created the CSS, maybe that's what you're seeing. It's probably the CSS files you need to change (or the .less files, and then re-compile them) – Clive Apr 2 at 14:57
  • It's commented out in the <mytheme>/scss/bootstrap.scss on both the prod (D7) and this dev (D8) version. Plus the CSS is the same so I am still not sure how it suddenly got started being used. I think I have to look at re-running the SCSS to rewire things(?). – Hometoy Apr 2 at 15:43
  • 1
    For less you would recompile the less files, not the sass files. Maybe you have the less browser plugin enabled and that’s doing something. Difficult to say without more info about the site and how it’s all configured to be honest – Clive Apr 2 at 15:44
  • Doesn't sass configure compiling to less files? The theme is a sub of bootstrap, the theme files were copied from the Drupal 7 site and I have modified the .tpl.php to .html.twig and the preprocessing in the .theme file (for things Drupal 8 doesn't do anymore). In the Developer window of the browser I see the Styles of the Elements and it shows the source (navbar.less) and the entry (.navbar-nav > li > a). But only on the D8. Same item on the D7 site and no reference to navbar.less on any element in the page. What else would help? – Hometoy Apr 2 at 15:58
  • Deleting the Less files should be considered harmful. These are CSS preprocess files. To build your CSS from maybe with Gulp or Grunt. No one writes pure CSS these days anymore. Everybody uses some CSS preprocessor like Less. Or Sass. – leymannx Apr 2 at 16:55
0

Seems the issue is completely different. The theme is based on bootstrap and In Drupal 7 the theme did not have a CDN provider option but in Drupal 8 it is defaulted to jsDelivr. The navbar.less and navs.less references came from the CDN stylesheet link. Changing the theme's CDN Provider to "None" removed the reference and these LESS file references are gone (as well as their styling). So it was a change in Bootstrap from Drupal 7 to Drupal 8 issue introducing the CDN (and about 20+ /core stylesheets).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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