user2656114
user2656114

Reputation: 970

Is it possible to use LESS with CSS on a CDN?

I am using a Bootswatch theme, for example Readable.

<link href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/yeti/bootstrap.min.css" rel="stylesheet">

Is it possible to use the variables.less file even though the main CSS is hosted on a CDN?

For example I want to change the font

@font-family-sans-serif: "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;.

Upvotes: 0

Views: 860

Answers (4)

harryg
harryg

Reputation: 24077

No, the css file on the CDN is precompiled with the default variables embedded.

If you wish to override only a few styles then just include your own css file after the cdn-hosted one with your modifications. E.g.

body {
    font-family: "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

This will override the ones in the original bootstrap file.

If you are making more extensive modifications then I'd advise to downloading the less source files and recompile with your changes. You can then have the resultant css file hosted on a CDN of your choice for enhanced performance.

Upvotes: 2

Marcin Nabiałek
Marcin Nabiałek

Reputation: 111829

LESS in only preprocessor that creates CSS files. So users should have served only CSS files and not LESS or SASS files. And those CSS you can then serve in CDN

Upvotes: 1

AlexPrinceton
AlexPrinceton

Reputation: 1203

You can but you need a converter LESS to CSS

Upvotes: 0

Quentin
Quentin

Reputation: 943214

Yes, but convert your LESS to CSS at build time and publish plain CSS to the CDN.

Doing it client side is likely to run in the Same Origin issues when trying to read the data from the remotely hosted file.

Upvotes: 1

Related Questions