-
Notifications
You must be signed in to change notification settings - Fork 17
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
Uglifyjs with sourcemaps option and file list. #38
base: master
Are you sure you want to change the base?
Conversation
* @param string $content Content of the file. | ||
* @return string | ||
*/ | ||
public function input($filename, $content) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening brace should be on a new line
Current coverage is 86.68% (diff: 0.00%)@@ master #38 diff @@
==========================================
Files 35 35
Lines 1022 1029 +7
Methods 173 174 +1
Messages 0 0
Branches 0 0
==========================================
Hits 892 892
- Misses 130 137 +7
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example of how the sourcemap options would be used in a config file?
@@ -41,8 +53,15 @@ class Uglifyjs extends AssetFilter | |||
*/ | |||
public function output($filename, $input) | |||
{ | |||
$cmd = $this->_settings['node'] . ' ' . $this->_settings['uglify'] . ' - ' . $this->_settings['options']; | |||
$files = implode(' ', $this->files); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this correctly escape files with spaces in their names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No for relative paths.
$files . ' ' . | ||
$this->_settings['options']; | ||
|
||
// $cmd = $this->_settings['node'] . ' ' . $this->_settings['uglify'] . ' - ' . $this->_settings['options']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you delete this instead of leaving behind commented out code?
In the compress_asset.ini file:
|
Thanks, I can use that to update the documentation. |
@markstory Is there sth else to do? I really need this feature :) |
I tried with realpath() to get it to work with file names with spaces, but I get errors at the helper level, which is beyond the scope of this PR. |
$env = array('NODE_PATH' => $this->_settings['node_path']); | ||
return $this->_runCmd($cmd, $input, $env); | ||
return $this->_runCmd($cmd, '', $env); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break filter chains that involve pre-processors and uglify? For example combining the coffescript or sprockets filter and uglify will no longer work as uglify will be told to use the source files and not the transformed results of those files.
Uglifyjs doesn't create source maps from STDIN, so we need the list of files.
You could put the domain in the asset_compress.ini like
--source-map-url http/yourdomain/cached_js/scripts.js.map
.And the option to create it.
create_map = true
.