As a novice in AngularJS, I encountered an issue with using grunt-contrib-less to handle less files instead of css. After installing it, I found myself having to declare all the less styles that need to be compiled into one css file.
The challenge for me is that normally when working with less, I would write specific code for each page. However, in this case, I have to write style code for all pages which can be confusing and challenging to maintain. So, I have been wondering if there is a best practice for organizing less styles?
I considered several possible solutions:
- Applying a class to the body tag and changing it using certain triggers (such as controllers or services) (Import LESS file only for one page)
- Generating multiple css files depending on which style needs to be compiled (although configuring grunt for this may be tricky)
- Using DOM manipulation (but I don't find this approach elegant as Angular should offer a better solution)
Can someone guide me on how to implement different styles for different views? I aim to avoid having the same style applied to all elements in all views without creating excessive classes.