Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cookbook][Assetic][Apply filter] Added node_paths /usr/lib/node_modules REQUIRED #2775

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cookbook/assetic/apply_to_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ as you'll see here, files that have a specific extension. To show you how
to handle each option, let's suppose that you want to use Assetic's CoffeeScript
filter, which compiles CoffeeScript files into Javascript.

The main configuration is just the paths to coffee and node. These default
respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``:
The main configuration is just the paths to coffee, node and node_modules. These default
respectively to ``/usr/bin/coffee``, ``/usr/bin/node`` and ``/usr/lib/node_modules``:

.. configuration-block::

Expand All @@ -22,6 +22,7 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``:
coffee:
bin: /usr/bin/coffee
node: /usr/bin/node
node_paths: [ /usr/lib/node_modules/ ]

.. code-block:: xml

Expand All @@ -30,7 +31,8 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``:
<assetic:filter
name="coffee"
bin="/usr/bin/coffee"
node="/usr/bin/node" />
node="/usr/bin/node"
node_paths="/usr/lib/node_modules/"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscores should be dashes. Also I'm not sure if this works, maybe we have to use <node-path>/usr/lib/node_modules/</node-path>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'r right, I used YAML, not tested on XML or PHP, if someone has tested if, please comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it cannot be configured at all in XML because the XSD has not been updated for it. but once done, it would look like this to allow a collection:

<assetic:filter name="coffee">
    <assetic:node-path>/usr/lib/node_modules/</assetic:node-path>
</assetic:filter>

</assetic:config>

.. code-block:: php
Expand All @@ -41,6 +43,7 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``:
'coffee' => array(
'bin' => '/usr/bin/coffee',
'node' => '/usr/bin/node',
'node_paths' => '/usr/lib/node_modules/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'node_paths' => array('/usr/lib/node_modules/'),

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, is a collection of node paths, as said, not tested on PHP, for those using PHP configuration, please comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoeRobles the PHP configuration works in a similar way than the Yaml one. So you should indeed pass an array

),
),
));
Expand Down Expand Up @@ -128,6 +131,7 @@ applied to all ``.coffee`` files:
coffee:
bin: /usr/bin/coffee
node: /usr/bin/node
node_paths: [ /usr/lib/node_modules/ ]
apply_to: "\.coffee$"

.. code-block:: xml
Expand All @@ -138,6 +142,7 @@ applied to all ``.coffee`` files:
name="coffee"
bin="/usr/bin/coffee"
node="/usr/bin/node"
node_paths="/usr/lib/node_modules/"
apply_to="\.coffee$" />
</assetic:config>

Expand All @@ -149,6 +154,7 @@ applied to all ``.coffee`` files:
'coffee' => array(
'bin' => '/usr/bin/coffee',
'node' => '/usr/bin/node',
'node_paths' => '/usr/lib/node_modules/',
'apply_to' => '\.coffee$',
),
),
Expand Down