Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attaching a SCSS to HTML docs [closed]

Tags:

html

css

sass

Hello I am new to web design. I would like to learn how to attach an SCSS file to an HTML file in the head tag :

<link href="example" rel="stylesheet/scss" type="text/css"> 

I tried this but did not see the result. I guess that it's like the LESS framework. And another question: If I want to use SCSS I should compile it to hosting or not?

like image 210
Cato Cato Avatar asked Oct 07 '13 00:10

Cato Cato


People also ask

Does browser read SCSS?

Unfortunately, the features of SCSS have yet to be introduced in the CSS specs and, therefore, are not supported by browsers. To run SCSS code in a web browser, you must first convert it to CSS.

How do I link a CSS file to HTML?

CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.


1 Answers

You can not "attach" a SASS/SCSS file to an HTML document.

SASS/SCSS is a CSS preprocessor that runs on the server and compiles to CSS code that your browser understands.

There are client-side alternatives to SASS that can be compiled in the browser using javascript such as LESS CSS, though I advise you compile to CSS for production use.

It's as simple as adding 2 lines of code to your HTML file.

<link rel="stylesheet/less" type="text/css" href="styles.less" /> <script src="less.js" type="text/javascript"></script> 
like image 145
SUDO Los Angeles Avatar answered Oct 18 '22 18:10

SUDO Los Angeles