问题描述
我使用Symfony2.3。*,我试图使assetic少过滤器工作。
我在dev环境中做所有这些。
I am using Symfony "2.3.*" and I attempt to make assetic less filter working.I do all of this in the "dev" environment.
当我发出 config:dump-reference assetic
我得到以下输出:
When I issue the config:dump-reference assetic
I get the following output:
assetic:
debug: %kernel.debug%
use_controller:
enabled: %kernel.debug%
profiler: false
read_from: %kernel.root_dir%/../web
write_to: %assetic.read_from%
java: /usr/bin/java
node: /usr/bin/node
node_paths: []
ruby: /usr/bin/ruby
sass: /usr/bin/sass
variables:
# Prototype
name: []
bundles:
# Defaults:
- FrameworkBundle
- SecurityBundle
- TwigBundle
- MonologBundle
- SwiftmailerBundle
- AsseticBundle
- DoctrineBundle
- SensioFrameworkExtraBundle
- FOSUserBundle
- JMSSerializerBundle
- YuccaPrerenderBundle
- WebProfilerBundle
- SensioDistributionBundle
- SensioGeneratorBundle
assets:
# Prototype
name:
inputs: []
filters: []
options:
# Prototype
name: []
filters:
# Prototype
name: []
twig:
functions:
# Prototype
name: []
所以,我的配置如下:
assetic:
debug: %kernel.debug%
use_controller: false
bundles:
- PlastoriaGiftoFrontBundle
#java: /usr/bin/java
node: "/usr/bin/nodejs"
node_paths: [ "/home/webadmin/websites/gifto/node_modules" ]
filters:
cssrewrite: ~
less: ~
closure:
jar: %kernel.root_dir%/Resources/java/compiler.jar
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar
打开Symfony控制台并发出 cache:clear
然后我转到缓存dir(app / cache)并执行 rm -rf *
。
我回到Symfony控制台并启动这两个命令后:
To test that it works, I do open the Symfony Console and issue cache:clear
Then I go to the cache dir (app/cache) and do rm -rf *
.After I come back in Symfony console and launch these two commands:
assets:install
assetic:dump
我收到以下信息:
节点二进制的配置被考虑在内:运行时出现错误:'/ usr / bin / nodejs'
The configuration for the node binary is taken into account : An error occurred while running: '/usr/bin/nodejs'
默认情况下,值为 / usr / bin / nodejs
。
我不知道有什么问题。在应用程序中使用 npm 安装less节点模块,并且在发出 npm ls
时,可以看到它已正确安装。
I can't figure out what's wrong. Did install "less" node module in the application using npm and when issuing npm ls
, I can see it is properly installed.
我还在应用程序目录中启动了 nodejs ,并且做了一个 require('less')
I also launched nodejs in the application directory and did a require('less')
and it worked without error.
使用nodejs配置assetic的正确方法是什么?
What is the right way of configuring assetic with nodejs ?
推荐答案
找到,
我在服务器中输入为 root (是的,我知道,不好的做法) $ c> su webadmin !
I entered in the server as root (Yes, I know, bad practice) then I su webadmin
!
诀窍是真正登入 webadmin 或 su webadmin -l 。
The trick is to really login as webadmin or
su webadmin -l
.
我测试了这是问题。
这篇关于symfony2.3配置assetic与较少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!