作者:手机用户2602903375 | 来源:互联网 | 2023-05-18 10:24
IhaveknowledgeofHTML,CSS,andjQuery.RecentlyIknewaboutSassandless.Astheybotharethe
I have knowledge of HTML, CSS, and jQuery. Recently I knew about Sass and less. As they both are the style sheet language I am a little bit confused about where to use both of them as CSS is already there and it is also widely used in every website. So how to know where to use these (Less, Sass) in that particular field.
我有HTML,CSS和jQuery的知识。最近我了解Sass而不是。由于它们都是样式表语言,我对它们两者的使用方式有点困惑,因为CSS已经存在,并且它也广泛用于每个网站。那么如何知道在特定领域中使用这些(Less,Sass)的位置。
Another doubt comes to my mind is, is it fine to use Sass and Less in wordpress instead of default CSS?
我想到的另一个疑问是,在wordpress中使用Sass和Less而不是默认的CSS是否可以?
3 个解决方案
12
As zzzzBov said, LESS and SASS are css preprocessors.
正如zzzzBov所说,LESS和SASS是css预处理器。
Basically, you pick one and write your style definitions in that language. When done you run it through the preprocessor and it will generate a normal CSS file for you. That normal file is what you would use in your site.
基本上,您选择一个并用该语言编写样式定义。完成后,通过预处理器运行它,它将为您生成一个普通的CSS文件。该普通文件是您在网站中使用的文件。
I'd highly suggest that you skip using SASS/LESS or any other preprocessor until you are more familiar with CSS in general.
我强烈建议你跳过使用SASS / LESS或任何其他预处理器,直到你对CSS更熟悉。
A little more information about LESS.
关于LESS的更多信息。
LESS can be run ahead of time as an actual preprocessor OR you can simply link the less.js file and your .less file and let the browser do it. The problem with letting the browser do it is that every single browser that hits your site, for every single page, will have to "recompile" the css in order to render your site correctly. Considering you have zero control over the computers hitting your sites this might result in a "slow" site from some peoples perspective.
LESS可以作为实际的预处理器提前运行,或者您只需链接less.js文件和.less文件,然后让浏览器执行此操作。让浏览器执行此操作的问题在于,每个浏览网站的每个浏览器都必须“重新编译”css才能正确呈现您的网站。考虑到您无法控制访问您网站的计算机,从某些人的角度来看,这可能会导致“慢”网站。
Further, that Javascript only works in some of the browsers, further limiting it's usefulness.
此外,Javascript仅适用于某些浏览器,进一步限制了它的实用性。
Quite frankly, CSS is one of those things that you generally set up once for a site and leave alone for a year or more. So, it may simply just not be worth it.
坦率地说,CSS是您通常为一个站点设置一次并且独自离开一年或更长时间的事情之一。所以,它可能只是不值得。