如果没有 Node.js,您将如何在 symfony2+Assetic 项目上使用 LESS
别误会我的意思。我知道我们有 lessc
甚至其他 php 编译器(我说的是 lessphp) 和其他。
但!你知道,我真的很喜欢less.js 工作方式。
我的意思是...
- 指向您的 less 文件
- 指向 javascript
- 工作
当您完成时
- 从浏览器获取
localStorage
版本 - 将其放入 CSS 文件中。
你有没有想过用一种方法来做类似的事情?
Don't get me wrong. I know we had lessc
and even other compilers in php (I'm talking about lessphp) and others.
But! You know, I really like less.js way to work.
What I mean...
- point to your less file
- Point to the javascript
- work
When you are done
- Get the
localStorage
version from the browser - Put it into a CSS file.
Have you ever thought of a way to do something similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不完全确定我理解这个问题。我将 sass 与 Symfony-2 一起使用。工作正常。有时我使用 --watch 选项进行自动更新。有时我会使用 Assetic scss 过滤器。从来没有少用过,但有一个过滤器。
我总是只签入最终的 css 文件,这样我就不需要在部署期间生成一个文件。
Not entirely sure i understand the question. I use sass with Symfony-2. Works fine. Sometimes I use the --watch option for automatic updates. Sometimes I use the Assetic scss filter. Never used less but there is a filter for it.
I always just checkin the final css file so I don't need to fool with generating one during deployment.
有一篇关于将 lessphp 与 assetic 一起使用的帖子:(因此不需要 Nodejs)
用于 Symfony2.1:https://gist。 github.com/3049271
对于 Symfony2.0: https://gist.github.com/1844433
seps:
添加以下行将代码添加到composer.json文件中:
运行composer install
最好的方法是将文件: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php 添加到 config.yml 文件中:
然后在模板中您可以使用如下所示的 less :
There is a post about using lessphp with assetic: (so no nodejs needed)
for Symfony2.1: https://gist.github.com/3049271
for Symfony2.0: https://gist.github.com/1844433
The seps:
Add the following lines of code to the composer.json file:
Run composer install
The best approach is to add file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php to config.yml file:
and then in your template you can use the less like this: