Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime exception when trying to dump assetic for Symfony2 project using Windows 7

I am using Windows platform (please do not laugh at me). And I am trying to build a Symfony2 project using asseti in my localmachine that is running Windows 7.

Now I can not for the love of my life figure out why it is not dumping the assetic files. It is always saying some kind of RunTime Exception. I think it has to do with the coffee bin and node path. Is this the right way to set paths for coffee bin and node?

framework:
    [...]


# Twig Configuration
twig:
    [...]

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: true
    bundles: [...]


    filters:
        sass:
            load_paths: [ "%kernel.root_dir%/../src/xxxxx/WebsiteBundle/Resources/public/vendor/" ]
            compass: true
        coffee:
            bin: C:\Users\xxxxx\AppData\Roaming\npm\coffee
            node: C:\Program Files\nodejs\node
        cssrewrite: ~


# Doctrine Configuration
[...]

php composer.phar install works fine

php app/console asset:install works fine

php app/console assetic:dump gives me the following error:

[RuntimeException]

Unable to write file C:/xampp/htdocs/xxxxx/app/../web/js/3b27a3f_js?key=AIzaSyCk9Cxgv09X9DKar1bcsLAXxlqP3YhF0OI_1.js

My initial feeling is that something wrong with the coffee bin and node path.

Below is where those are in my machine.

enter image description here

enter image description here

I have no idea what's going on. I'll dump you any output that might help solve this. I feel clueless here. I am using SASS, Compass, coffee, etc.

like image 377
Hello Universe Avatar asked Feb 02 '15 00:02

Hello Universe


1 Answers

integration of Symfony2 and Assetic

1. file config.yml

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
    less: 
        node: "C:\\Program Files (x86)\\nodejs\\node.exe"
        node_paths: ["C:\\Users\\websky\\AppData\\Roaming\\npm\\node_modules"] 
        apply_to:   "\.less$"
    yui_css: 
        jar: %kernel.root_dir%/../java/yuicompressor-2.4.6.jar 
    yui_js: 
        jar: %kernel.root_dir%/../java/yuicompressor-2.4.6.jar 
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"

2. file base.html.twig

    <head> 
        {% stylesheets filter='less,?yui_css' '@AcmeBundle/Resources/less/main.less' %} 
        <link href="{{ asset_url }}" rel="stylesheet" media="screen" /> 
        {% endstylesheets %} 
    </head> 

3. building assetic

php app/console assetic:dump --env=prod

useful link: Less Windows Node.js Hanging

like image 148
websky Avatar answered Oct 28 '22 20:10

websky