Code Monkey home page Code Monkey logo

grunt-smushit's Issues

Won't generate compressed images

Hi,

Im new to node stuff but still im trying to use this grunt plugin.
When i run grunt it seams to run my original images folder, returning lines like this:

[grunt-smushit] New optimized file: images/dist/temp/themeGallery-02.jpg
[smushit] smushit completed: total 1, saving 0

When i check the destination folder grunt as recreated the folder structure but didn't create any image.

Am i missing something?

Regards.

Single file replacement

Create test cases and support this task config:

grunt.initConfig({
  smushit: {

    // a single directory
    group1: {
      src: 'tests/img'
    },

    // filter by filetype
    group2: {
      src: ['tests/img/**/*.png','tests/img/**/*.jpg']
    },

    //replace recursive
    group3: {
      src: ['tests/img/logo.png','tests/img/tellme.jpg']
    }

  }
});

Grunt-smushit not smushing all images and corrupts images

Hi,

I'm having an issue when I try to smush a bunch of png's using this:

destination:{
    src:'path/to/unsmushed/images',
    dest:'different/path/to/smushed/images'
}

Grunt-smushit, successfully smushes a few images (1-5, kinda randomly). But sometimes some files are corrupted.

Increasing the delay parameter of the setTimeout in tasks/smushit.js (line 38) seems to fix this issue, but adds unwanted delay to the end of the smushit task.

Thank you for your help and Grunt plugin !

Output Folder

Create test cases and support this config:

grunt.initConfig({
  smushit: {

    // catch all files from a single folder
    group1: {
      src: 'tests/img',
      dest: 'tests/opt_img'
    },

    // filter by filetype
    group2: {
      src: ['tests/img/**/*.png','tests/img/**/*.jpg'],
      dest: 'tests/img/min'
    },

    // set each file
    group3:{
        src: ['tests/img/logo.png','tests/img/whatever.png'],
        dest: 'tests/img/min'
    }

  }
});

Wrong output directory created when using current directory pattern (./) in src

When using src patterns such as ./img instead of img, an extraneous g/ directory is created in the dest dir. I don't see why one src pattern is to be preferred over the other; both are valid paths and both should work.

This is essentially a duplicate of #28 that @dmcass opened. There is substance here, however his fix was incorrect. Instead of hardcoding a + 1 (cc764d9), it seems better to always path.normalize filepath in the same way that fileDir is normalized.

Refusing to install grunt-smushit as a dependency of itself

grunt/grunt-smushit (master)
$ npm install grunt-smushit
npm WARN install Refusing to install grunt-smushit as a dependency of itself

And:

$ grunt
Running "jshint:files" (jshint) task
Linting tasks/smushit.js...ERROR
[L36:C1] Trailing whitespace.

Why that?Thanks.

Combined move/smushit

An option with one/many input files (possibly a folder), with an output folder. This is to keep the source images unsmushed while working with them.

Linting tasks/smushit.js...ERROR

That has a problem in smushit.js:

$ grunt build
Running "jshint:files" (jshint) task
Linting tasks/smushit.js...ERROR
[L36:C1] Trailing whitespace.

Smushing in different folder

So, I've started testing this, but realised that I'd need to name each file individually, rather than being able to just recursively moving/smushing an entire folder.

Is this something you're working on, or not interested in? (If it's not something you're interested in, I'm planning on working on it, since I need it =)

Option for "quieter" output?

I'd like to be able to configure whether to display the full file list while the task is running. In my case, we have dozens of files that are being compressed, and the deluge of output is not always useful for us. I'd like to see something like this (it doesn't have to be named verbose, but that seemed like a good enough name for the example):

...
  smushit: {
    options: {
      verbose: false
    },
    mygroup: {
      src: ['tests/img/**/*.png','tests/img/**/*.jpg'],
      dest: 'tests/img/min'
    }
  }
...

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

Update to be grunt 0.4.x compatible

When I try to utilize the smushit task with grunt 0.4.0a, it fails:

Running "smushit:destination" (smushit) task
Warning: Cannot call method 'kindOf' of undefined Use --force to continue.

Aborted due to warnings.

Here's my [simplified] "Gruntfile.js" configuration:

module.exports = function(grunt) {
  grunt.initConfig({
    clean: {
      all: ['out/']
    },
    smushit: {
      destination: {
        src: ['in/*.png', 'in/*.jpg'],
        dest: 'out/'
      }
    }
  });

  // Load supplemental libraries
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-smushit');

  // Default task
  grunt.registerTask('default', ['clean', 'smushit']);
};

Create service option

As reported on #16 , a grunt-smushit user must have the option to set your favorite service. The v1 release must cover it using the grunt options object.

grunt.initConfig({
  smushit: {
    options: {
      service: 'http://myimgopt.com/exec'
    },
    mygroup: {
      src: ['tests/img/**/*.png','tests/img/**/*.jpg'],
      dest: 'tests/img/min'
    }
  }
});

Recreate folder structure in destination?

I like your task!
Is it possible to recreate the folder structure in the target folder when using:

destination:{
    src:'tests/img',
    dest:'tests/img/min'
},

Thanks in advance!

Tries to compress .svn-base files

I'm probably doing something wrong, but also this may be a bug.

Here's my config:

smushit: {
        group1: {
            cwd: '',
            expand: true,
            src: ['images/**/*.png'],
            dest: 'dist/images',
            ext: '.png'
        },
    },

The output is:

Running "smushit:group1" (smushit) task
[smushit] start smash dist/images/icons/.svn/prop-base/apple-touch-icon-114x114-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/prop-base/apple-touch-icon-144x144-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/prop-base/apple-touch-icon-72x72-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/prop-base/apple-touch-icon-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/text-base/apple-touch-icon-114x114-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/text-base/apple-touch-icon-144x144-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/text-base/apple-touch-icon-72x72-precomposed.png.svn-base
[smushit] start smash dist/images/icons/.svn/text-base/apple-touch-icon-precomposed.png.svn-base
[smushit] start smash dist/images/icons/apple-touch-icon-114x114-precomposed.png
[smushit] start smash dist/images/icons/apple-touch-icon-144x144-precomposed.png
[smushit] start smash dist/images/icons/apple-touch-icon-72x72-precomposed.png
[smushit] start smash dist/images/icons/apple-touch-icon-precomposed.png
[smushit] item: dist/images/icons/.svn/prop-base/apple-touch-icon-144x144-precomposed.png.svn-base error: Cannot determine the type, is this an image?
[smushit] item: dist/images/icons/.svn/prop-base/apple-touch-icon-precomposed.png.svn-base error: Cannot determine the type, is this an image?
[smushit] item: dist/images/icons/.svn/prop-base/apple-touch-icon-72x72-precomposed.png.svn-base error: Cannot determine the type, is this an image?
[smushit] item: dist/images/icons/.svn/prop-base/apple-touch-icon-114x114-precomposed.png.svn-base error: Cannot determine the type, is this an image?
[smushit] item: dist/images/icons/.svn/text-base/apple-touch-icon-114x114-precomposed.png.svn-base error: No savings
[smushit] item: dist/images/icons/.svn/text-base/apple-touch-icon-72x72-precomposed.png.svn-base error: No savings
[smushit] item: dist/images/icons/.svn/text-base/apple-touch-icon-144x144-precomposed.png.svn-base error: No savings
[smushit] item: dist/images/icons/.svn/text-base/apple-touch-icon-precomposed.png.svn-base error: No savings
[smushit] item: dist/images/icons/apple-touch-icon-114x114-precomposed.png saving: 49.17%
[smushit] item: dist/images/icons/apple-touch-icon-precomposed.png saving: 61.62%
[smushit] item: dist/images/icons/apple-touch-icon-72x72-precomposed.png saving: 61.82%
[smushit] item: dist/images/icons/apple-touch-icon-144x144-precomposed.png saving: 60.78%
[smushit] smushit completed: total 12, saving 4

If I use src: ['images/**/*.png', '!images/**.svn*] or something similar, it tells me that the !images path is not found.

Any thoughts?

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.