Note: There are two different ways to import a CSS file into another using @import url(“style2. css”); or @import “style2. css”; or directly import any CSS file or multiple CSS file in the HTML file directly within <style>@import “style1.
If you specify a file is less and do not include an extension, none will be added. This is the correct answer. The third one will import+compile the CSS code as less code and will not leave the directive intact.
Click on the URL button, Enter URL and Submit. This tool supports loading the CSS File to transform to LESS. Click on the Upload button and select File. CSS to LESS Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.
The best way to do this is to @import your LESS file with all your variables in it. Here's the syntax for the @import keyword: // For LESS file includes, @import "lib. less"; // or @import "lib"; // infers the .
You can force a file to be interpreted as a particular type by specifying an option, e.g.:
@import (css) "lib";
will output
@import "lib";
and
@import (less) "lib.css";
will import the lib.css
file and treat it as less. If you specify a file is less and do not include an extension, none will be added.
If you want your CSS to be copied into the output without being processed, you can use the (inline)
directive. e.g.,
@import (inline) '../timepicker/jquery.ui.timepicker.css';
I had to use the following with version 1.7.4
@import (less) "foo.css"
I know the accepted answer is @import (css) "foo.css"
but it didn't work. If you want to reuse your css class in your new less file, you need to use (less)
and not (css)
.
Check the documentation.
Change the file extension of your css file to .less
. You don't need to write any LESS in it; all CSS is valid LESS (except of the MS stuff that you have to escape, but that's another issue.)
Per Fractalf's answer this is fixed in v1.4.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With