How to change SASS with LESS in ionic 2


#1

I want to use LESS for my application in IONIC 2.
Found few links but there is no answer to change this.
Can anyone help me?. Project requirement is LESS hence I have no other choice but to use LESS.


#2

Waiting for some response. As this is stopping my productivity.


#3

I don’t have a complete answer for you, but here are a few thoughts and that might help you.

SASS isn’t compatible with LESS, that means that you cannot just import Ionic’s SASS into your LESS code and start modifying variables.

What you will need to do is:

  • Add a new build process on top of the app (i.e gulp) to compile your LESS code to CSS, then import that CSS file in index.html… or,
  • If you want to only have a single CSS file in your app for some reason… do the following:
    1. compile a blank Ionic app
    2. copy the generated CSS file
    3. copy that file to your assets directory
    4. import the CSS file into your LESS main file

If you go with the second option (single CSS output), you probably want to visit the Ionic App Scripts repo and figure out how to disable the scripts from compiling the SASS files… this is not really needed but you might want to do it.


#4

Thanks but i dont want to use SASS with LESS. I just wanted to use LESS with ionic.
Gulp is an alternative for sure. But i thought if ionic has some option to change styling.

But thats fine. Thanks for the response. I will use SASS instead. No issues. :slight_smile: