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

Not minify #13

Closed
zzroche opened this issue Feb 14, 2019 · 6 comments
Closed

Not minify #13

zzroche opened this issue Feb 14, 2019 · 6 comments
Assignees

Comments

@zzroche
Copy link

zzroche commented Feb 14, 2019

Hi, the plugin doesn't return me any error, copy the file in the dest directory but doesn't minify.

@zzroche
Copy link
Author

zzroche commented Feb 14, 2019

Ah, doesn't return any error:

  • node -v 10.15.1
  • npm -v 6.7.0
  • gulp -v
    [16:57:52] CLI version 2.0.1
    [16:57:52] Local version 4.0.0

@cedx cedx self-assigned this Feb 17, 2019
@cedx
Copy link
Owner

cedx commented Feb 17, 2019

Could you post the code of your Gulp task, please?

@zzroche
Copy link
Author

zzroche commented Feb 18, 2019

I've tried this:

task('compress:php__tmp->dist', done => {
src(tmp+'**/*.php', {read: false})
.pipe(phpMinify({
binary: 'C:\xampp\php\php.exe'
,silent:false
// ,mode: TransformMode.fast
// ,
// removeComments: true,
// collapseWhitespace: true
}))
.on('error', err => console.log(err))
.pipe(dest(dist));
done();
});


and this:

const {phpMinify, TransformMode} = require('@cedx/gulp-php-minify');

task('compress:php', () => src(tmp+'**/*.php', {read: false})
.pipe(phpMinify({
binary: process.platform == 'win32' ? 'C:\xampp\php\php.exe' : '/usr/bin/php',
mode: process.platform == 'win32' ? TransformMode.safe : TransformMode.fast,
silent: process.stdout.isTTY
}))
.pipe(dest(dist))
);

@cedx
Copy link
Owner

cedx commented Feb 18, 2019

The second sample is better than the first : the call to done is useless when you use the gulp.src API.
But I have strictly no idea why the plug-in doesn't work for you (i.e. the code seems fine, except for the Windows binary that should be C:\\xampp\\php\\php.exe => notice how the slashes are doubled).
I need more info... What is the value of tmp and dist variables ?

@zzroche
Copy link
Author

zzroche commented Feb 19, 2019

If I remove the double slash gulp return:

c:\Users......\gulpfile.js:34
binary: process.platform == 'win32' ? 'C:\xampp\php\php.exe' : '/usr/bin/php',
^^^^

SyntaxError: Invalid hexadecimal escape sequence
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)


tmp and dist are variables that indicate the directory.

I've use this plugin without gulp, using a single javascript using via node.js and work well. I think is gulp the problem.

@cedx
Copy link
Owner

cedx commented Feb 24, 2019

I also think it comes from the way the Gulp task is coded (although your example seems quite correct).
If it came from the plugin, either we would get an error, or the destination files would not be created. But in any case, we can't have the same content before and after applying the plugin.
I close this ticket unless you have other tracks to explore.

@cedx cedx closed this as completed Feb 24, 2019
@cedx cedx added the invalid label Feb 24, 2019
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

2 participants