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

always creating new output, even though source files have not changed #7

Open
wivaku opened this issue Jul 16, 2015 · 1 comment
Open
Assignees

Comments

@wivaku
Copy link

wivaku commented Jul 16, 2015

could be it is a combination of issues when using magic-min v3.0.4:

  1. it always creates a new minified file, even when the source js files have not been modified, see log and timestamps

  2. I need to explicitly add the minified output file to the exclude array, otherwise it will be included in the merge process (note the leading ./ that is needed to exclude the file ):
    $m = new Minifier(array("gzip"=>false,'closure'=>true, 'advanced_optimizations'=>true ));
    $m->merge( 'js/moves.min.js', './js', 'js', array('./js/moves.min.js') );

  3. related: I have closure-compiler installed locally, is it possible to use that one instead of the API?

  4. related: when I use the local closure-compiler (built: 2015/06/27 10:54), I get a smaller file than the one created by the Minifier class. I used:
    sudo closure-compiler --compilation_level ADVANCED_OPTIMIZATIONS --js moves.js --js movesCalendar.js --js movesDetails.js --js movesMap.js --js_output_file moves.min.js
    -rw-r--r-- 1 _www _www 18490 Jul 16 14:35 moves.min.js
    So 18490 instead of 24593 bytes.

log
(index):439 Minifier Log : echo: 1
(index):440 Minifier Log : encode:
(index):441 Minifier Log : timer: 1
(index):442 Minifier Log : gzip:
(index):443 Minifier Log : closure: 1
(index):444 Minifier Log : remove_comments: 1
(index):445 Minifier Log : hashed_filenames:
(index):446 Minifier Log : output_log:
(index):447 Minifier Log : force_rebuild:
(index):448 Minifier Log: New File Flagged : Flagged for update by ./js/moves.js
(index):449 Minifier Log: New File Flagged : Flagged for update by ./js/movesCalendar.js
(index):450 Minifier Log: New File Flagged : Flagged for update by ./js/movesDetails.js
(index):451 Minifier Log: New File Flagged : Flagged for update by ./js/movesMap.js
(index):452 Minifier Log: Creating new : js/moves.min.js exists but flagged for new
(index):453 Minifier note : Writing new file to js
(index):454 Minifier Log: New file : Successfully created js/moves.min.js
(index):455 Minifier Log: timer : MagicMin processed and loaded in 3.1951620578766 seconds

file timetamps
-rw-r--r-- 1 wvk _www 9123 Jul 13 17:54 moves.js
-rw-r--r-- 1 wvk _www 2861 Jul 13 18:56 movesCalendar.js
-rw-r--r-- 1 wvk _www 22618 Jul 13 19:00 movesMap.js
-rw-r--r-- 1 wvk _www 23159 Jul 15 13:24 movesDetails.js
-rw-r--r-- 1 _www _www 24593 Jul 16 14:21 moves.min.js

@bennettstone bennettstone self-assigned this Jul 27, 2015
@mcormick
Copy link

mcormick commented Jun 27, 2016

I have the same issue on 3.0.4.
Both line 930

if( count( $minified_filelist ) != count( $this->compilation ) )

and line 918

if( file_exists( $minified_name ) && ( !$this->remote_file( $this->file ) ) && ( $this->gmstamp( filemtime( $this->file ) ) > $minfile->filemtime ) || !in_array( $this->file, $minified_filelist ) )

return true and set $this->create_new = true;.
The stylesheet line <link rel="stylesheet" href="<?php $minified->merge( 'assets/style.css', 'assets/css', 'css' ); ?>" /> is always re-generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants