GithubHelp home page GithubHelp logo

Comments (9)

tkellen avatar tkellen commented on August 14, 2024

This should be what you're looking for: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

from grunt-contrib-compress.

evanworley avatar evanworley commented on August 14, 2024

Hi Tkellen,

Thanks for the reply. I'm familiar with building the file object dynamically, but when I do it in the way that I am familiar with, I get an error that no archive is specified. In case I wasn't clear, I am looking to individually compresses all files in a given directory (so for each foo.txt there will be a foo.txt.gz next to it). This is pre-compression to use with nginx gzip_static feature.

Can you please help me understand what configuration will achieve this? Right now I have the following configuration and it does not work.

compress:
  dist:
    expand: true
    cwd: 'dist/'
    src: ['**/*.js', "**/*.css", "**/*.html"]
    dest: 'dist'
    ext: '.gz'

Thanks!
Evan

from grunt-contrib-compress.

tkellen avatar tkellen commented on August 14, 2024

Mode auto-detection is handled by the archive option, which doesn't apply to your style of compression.

Please try:

compress:
  dist:
    expand: true
    cwd: 'dist/'
    src: ['**/*.js', "**/*.css", "**/*.html"]
    dest: 'dist'
    ext: '.gz'
  options:
    mode: 'gzip'

from grunt-contrib-compress.

evanworley avatar evanworley commented on August 14, 2024

I tried that configuration, and I got the following error message

Running "compress:dist" (compress) task
Warning: Unable to compress; no valid archive file was specified. Use --force to continue.

from grunt-contrib-compress.

tkellen avatar tkellen commented on August 14, 2024

You're right. The gzip mode for this task is totally borked. I'll take a look at fixing it soon.

from grunt-contrib-compress.

evanworley avatar evanworley commented on August 14, 2024

Thanks!

from grunt-contrib-compress.

shama avatar shama commented on August 14, 2024

@evanworley This should be fixed now on v0.4.2. Thanks!

from grunt-contrib-compress.

evanworley avatar evanworley commented on August 14, 2024

Thanks for the quick fix. It works for the happy path case, but not when you have empty files. Please see my comment in c1c21e5

from grunt-contrib-compress.

shama avatar shama commented on August 14, 2024

Fixed and published as v0.4.3. Thanks again!

from grunt-contrib-compress.

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.