Code Monkey home page Code Monkey logo

grunt-data-uri's People

Contributors

ahomu avatar heldr avatar nolanlawson avatar zonito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

grunt-data-uri's Issues

little bug

file: tasks/data-uri.js
line: 99
is: replacement = u;
shuld be: replacement = uri;

Set the root for relative images path

In my work flow using grunt-usemin, first all styles will be concatenate in a new file in the dist folder, so to use your task I need a way to tell the task whats the root for the images paths in this concatenated files.

Warning: u is not defined

Using Grunt 0.4.1, and the following settings:

the exception below is thrown.

Warning: u is not defined Use --force to continue.
ReferenceError: u is not defined
    at module.exports.path.relative.split.forEach.resolvedPath (/Users/mars/Dropbox/interactive-suite/node_modules/grunt-data-uri/tasks/data-uri.js:99:27)
    at Array.forEach (native)
    at /Users/mars/Dropbox/interactive-suite/node_modules/grunt-data-uri/tasks/data-uri.js:78:12
    at Array.forEach (native)
    at Object.<anonymous> (/Users/mars/Dropbox/interactive-suite/node_modules/grunt-data-uri/tasks/data-uri.js:42:14)
    at Object.task.registerMultiTask.thisTask (/Users/mars/Dropbox/interactive-suite/node_modules/grunt/lib/grunt/task.js:258:15)
    at Object.task.registerTask.thisTask.fn (/Users/mars/Dropbox/interactive-suite/node_modules/grunt/lib/grunt/task.js:78:16)
    at Object.Task.start._running (/Users/mars/Dropbox/interactive-suite/node_modules/grunt/lib/util/task.js:282:30)
    at Task.runTaskFn (/Users/mars/Dropbox/interactive-suite/node_modules/grunt/lib/util/task.js:235:24)
    at Task.<anonymous> (/Users/mars/Dropbox/interactive-suite/node_modules/grunt/lib/util/task.js:281:12)

Ignore IMG path,depending on the location of the grunt.js

OK:
/grunt.js
/css/style.css
/img/embed.png

NG:
/build/grunt.js
/css/style.css
/img/embed.png

in NG case, grunt.js is shown below:

dataUri: {
  dist: {
    src: ['../css/style.css'],
    dest: '../css/test',
    options: {
      target: [
        '../img/embed.png'
      ],
      fixDirLevel: true
    }
  }

grunt-data-uri found uri in CSS, but Ignore IMG path.
Is there a solution?

Does not restore CWD correctly after task finishes

In my grunt process I use grunt.file.setBase("../") in order to include my entire repo in the grunt process.

The module uses setBase() to allow for computing adjustment base URLs, etc (understandable), but at the end it sets the base back to a stored base path of path.resolve('./') which may not actually be the original base path (it only MIGHT be if no setBase() was called after the module initialized).

This can be corrected by adding this line to the beginning of the multi-task:

var originalCWD = process.cwd();

and then replacing the grunt.file.setBase(gruntfileDir); at the end with:

grunt.file.setBase(originalCWD);

This ensures that any setBase called by the grunt setup process will be properly respected at the beginning and restored at the end of each task.

Use of variable in output path fails

I use a version number in my paths:

dataUri: {
      dist: {
        // src file
        src: ['build/v<%= pkg.version %>/css/wimp.css'],
        // output dir
        dest: 'build/v<%= pkg.version %>/css',
        options: {
          // specified files are only encoding
          target: ['build/v<%= pkg.version %>/img/*.*']
        }
      }
    }

This fails for 'dest' since it is not read by a grunt method.

Proposed change to data-uri.js:
Line 26:
destDir = path.resolve(this.data.dest),
to:
destDir = grunt.file.expandDirs(this.data.dest),
And line 33:
outputTo = destDir+'/'+path.basename(src),
to:
outputTo = destDir+path.basename(src),

(I have not tested if this requires changes to the path renaming part of the code, as I'm not using that.)

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!

Doesn't work with grunt-newer

When used with grunt-newer, plugin throws error "Warning: Cannot read property 'indexOf' of undefined Use --force to continue.". It is probably caused by non-standard src-dest mappings used by grunt-data-uri.

Problem is, grunt-newer always passes files in options, even though src and dest were set. It assumes, that whatever plugin it calls, it supports files array format.

Error in expandFiles

Using grunt 0.4.0 and grunt-data-uri 0.1.1, i'm getting this error:

"Warning: Arguments to path.join must be strings Use --force to continue."

Which is caused by calling grunt.file.expand({filter: 'isFile'}, files); without "cwd" option

TypeError: Cannot read property 'indexOf' of undefined

dist: {
    src: [ "cache/views/index.css" ],
    dest: "cache/views/index.css",
}
➜ grunt dataUri
Running "dataUri:dist" (dataUri) task
[TypeError: Cannot read property 'indexOf' of undefined]
Warning: Cannot read property 'indexOf' of undefined Use --force to continue.
➜ uname -a
Darwin MacBook-Pro--Monolithed.local 14.1.0 Darwin Kernel Version 14.1.0: 
Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64

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.