Giter Site home page Giter Site logo

Not minify about php-minifier HOT 6 CLOSED

zzroche avatar zzroche commented on June 16, 2024
Not minify

from php-minifier.

Comments (6)

zzroche avatar zzroche commented on June 16, 2024

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

from php-minifier.

cedx avatar cedx commented on June 16, 2024

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

from php-minifier.

zzroche avatar zzroche commented on June 16, 2024

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))
);

from php-minifier.

cedx avatar cedx commented on June 16, 2024

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 ?

from php-minifier.

zzroche avatar zzroche commented on June 16, 2024

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.

from php-minifier.

cedx avatar cedx commented on June 16, 2024

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.

from php-minifier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.