6

I currently have a module installed inside of the following directory:

httpdocs/vendor/module/module-name

I've installed the module with composer and it works. However I've noticed the module is adding its own styles to the style sheets (obviously its going to it has less files in it), I want to remove the styles that the module is adding, using my theme.

The current location the module is making the styles is:

module/module-name/web/css/source/module.less

enter image description here

Style.css is empty - and I assume this is for custom styles as this doesn't get compiled into the main style sheets.

Do i go about it by creating the module inside of my theme and overwriting it like i do all magento core ones, or should I overwrite the module and stop it loading the styles all together.

My main issue is i want to remove the styles all together without touching the original module (they're annoying me) - as im sure that will get updated and i'd like to keep it up to date through composer.

The styles are very intrusive and break my layout - any help would be awesome

asked Apr 24, 2017 at 10:06

2 Answers 2

12

Put an empty file in here {theme}/Vendor_Module/web/css/source/_module.less. The blank file will override the module's _module.less file. You shouldn't need to bother with the other .less files.

Then you have to clear the static content so that Less gets recompiled : rm -rf pub/static/* var/view_preprocessed/*.

answered Apr 24, 2017 at 11:57
1
  • 1
    yep worked. I tried this, but i forgot to clear the pub/static and preprocessed. Thanks :) Commented Apr 24, 2017 at 12:40
0

How the module call the css file? Is it called in the head via any xml layout?

You probably can do the following in one of your theme layout file:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <remove src="name.css"/>
 </head>
</page>

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#layout_markup_css_remove

answered Apr 24, 2017 at 10:15
3
  • Isn't called into the header via the XML seems to be loaded differently. This was my original thoughts, as i could just remove it. Seems to compile into the base css/styles-l.css and css/styles-m.css Commented Apr 24, 2017 at 10:27
  • Could you please describe the web/css files names and structure Commented Apr 24, 2017 at 10:30
  • Edited question to show what im working with. Commented Apr 24, 2017 at 10:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.