Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run SASS or LESS on a shared host?

Tags:

css

sass

less

I would like to use variables in CSS, so I am considering using either SASS or LESS for that purpose.

My problem, however, is that I will be deploying the project on a shared host, not a dedicated host with command line access.

I also don't like the idea of my users having to compile CSS files in their browsers using Javascript. (What if they have Javascript disabled?)

What is the best way to deal with this kind of situation? Will I have to resort to plain old CSS in the end? I hope not...

like image 926
Tintin81 Avatar asked Nov 27 '12 21:11

Tintin81


People also ask

Do I have to install Sass in every project?

You'll never need to install Sass again! Npm is a command line interface that comes bundled with the server framework, node. js. It installs packages for us, as well as allows us to execute scripts and manage our dependencies.

How do I run a Sass command?

The command to run Sass is sass --watch input. scss output. css where 'input. scss' is your main Sass file (with all your partials imported) and 'output.

Can you use Sass without NPM?

Yes, we can compile SCSS/SASS to CSS without using any Node Command. With just one click you can compile SCSS/CSS to CSS. Click on the Extensions button on left side.


2 Answers

Compile the Sass or Less on your development machine, and push the compiled, minified CSS to your server.

like image 156
bookcasey Avatar answered Oct 13 '22 22:10

bookcasey


You've got a contradiction.

If you would like to have full control over your site, you should get an own server, either dedicated or virtual. This would let you installing and running any stuff you want.

If you're not allowed to install and run custom software on your shared host, then you're not able to compile SASS on-the-fly. You have to compile SASS prior to uploading code to the server.

If you're not satisfied with a necessity of compiling SASS locally, you could automate it using a deployment technique like Capistrano or probably your IDE. The choice of a deployment tool highly depends on your development and hosting environments.

Another option is compiling LESS locally in clients' browsers. See http://lesscss.org/#usage. But i wouldn't recommend that for two reasons:

  1. This would make your website less accessible (what an irony!). You shouldn't rely on heavy JS for applying basic styles to your website.
  2. SASS is preferred over LESS for several reasons, the main of them is the awesome Compass toolkit.
like image 38
Andrey Mikhaylov - lolmaus Avatar answered Oct 13 '22 22:10

Andrey Mikhaylov - lolmaus