-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Combination of Phantom and not specifying algorithm causes 0 size png to be generated #47
Comments
Interesting, we might have reached an upper limit with the maximum height of the canvas. What is the average image height and width?
|
Sorry for the crude example, but if you download the latest version of Dojo: http://download.dojotoolkit.org/release-1.9.1/dojo-release-1.9.1.zip then add in the build files below in you'll hopefully see how adding the algorithm ('algorithm': 'binary-tree') solves the problem: package.json {
"name": "Problem",
"version": "0.0.1",
"description": "Issue 47",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "James Gough",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-spritesmith": "~1.11.3",
"grunt-sprite-generator": "0.0.2"
}
} Gruntfile.js module.exports = function(grunt) {
grunt
.initConfig({
pkg : grunt.file.readJSON('package.json'),
sprite : {
dojo_sp : {
src : '**/*.png',
destImg : 'dojo-release-sprite.png',
destCSS : 'dojo-release-sprite.css',
'engine' : 'phantomjs'
}
}
});
grunt.loadNpmTasks('grunt-spritesmith');
grunt.registerTask('default', [ 'sprite' ]);
}; |
No worries, any example is much better than no example =) I will take a look at this by the end of the week. |
As a heads up, #46 has been resolved which means if you upgrade to the latest minor ( I might take a look at your issue tonight but it is starting to get late. |
Thanks for the heads up, I'll give the minor version a go. No rush on looking at my issues, as there's a valid workaround - thanks for taking a look. |
I have taken a look but I am unable to reproduce. I am seeing an 83kB CSS and 176MB png. I tossed the work into a gist |
The newer version of spritesmith generates a 871kB png. It does take a lot longer to generate the file but that is due to a flaw in spritesmith; everything is buffer to memory instead of streamed out. |
What OS did you try it on? Is there anything else I can do on my side to try get a more reproducible example? If not I'm happy to close this as it could just be my dev machine. |
I am running Linux Mint 14. What are you running? I am going to try pushing PhantomJS to its limits by adding more and more sprites. |
Sadly here I'm on Windows 7. |
Ah, cool. I can fire up a VM to see if I can reproduce. |
Thanks, sorry I meant to write it in the issue - user fail :). |
Interesting conclusion to the canvas case, it seems I run out of memory when I double up on the sprites
|
Okay, I have successfully reproduced on Windows 7. |
Interstingly enough, you seem to have leapfrogged another Windows specific error. Writing out 200 of those sprites leads to an |
Okay, the issue seems to be in phantomjssmith, the phantomjs engine. We are emitting 245515298 bytes of data which is too damn much for node to allow. As a result, it seems to be dropping it all =( I don't have time to patch this tonight but I will leave it open for later. |
I saw this one too: |
Took another shot at this tonight. I have spent too much time on it and Windows is being very unfriendly. I am going to leave this as an open issue. I will try to come back to this but for now, I am too frustrated and have other projects to attend to. |
No problem at all, Windows is usually very unfriendly anyway! At least we have a documented workaround here with setting the algorithm explicitly - so definitely more important things to be doing. Thanks for your help to date. |
i am on windows7. the generated png file and css file are both likely empty. sprite:{
all: {
src: 'style/sprites/*.png',
destImg: 'style/img/spritesheet.png',
destCSS: 'style/css/sprites.css'
}
}, The png file has zero file size, so it can't be opened by windows image viewer. Css file is below; /*
Icon classes can be used entirely standalone. They are named after their original file names.
<i class="icon-home"></i>
*/ |
@hite Can you run the test suite? # Clone the repository
git clone https://github.com/Ensighten/grunt-spritesmith
cd grunt-spritesmith
# Install dependencies
npm install
# Run our test suite
npm test |
@twolfson Meanwhile, pngparse is not installed correctly i am afraid ,and Npm warn is
Package canvas is not installed too, but i don't think that Canvas is neccesary when pngparser engine is default engine |
Ah, that is a legacy issue from still having a
The errors you are seeing are not critical, feel free to ignore them. |
@twolfson Thanks your help. It works in another way. i execute 'DOSKEY grunt=grunt.cmd $*', and grunt file is still opened by Notepad(DAMN it) . Anyway i enter into directory
it gets much reasonable becauce i do't install required package indeed. i will try again after the required packages are installed. Thx again. PS:In your location ,it is early morning ,is it? |
Ugh, sorry about that. I dislike having those dependencies in the test suite =( It is technically early morning but it isn't too late either. Also, I am on break now so my schedule is a bit different. |
That usually means there were no files found. Please run |
I would guess it is due to the misspelling of src: "pulic/images/*.png",
TO
src: "public/images/*.png", |
Oh, sorry! I am so stupid! |
On mac everything is fine.
Removing timeout option leads to
|
@ssuvorov It sounds like you are experiencing a separate bug entirely. Please file a separate issue. |
Firstly, thanks for an awesome grunt plugin. I had some issues today using this for the first time on Windows with Phantom. I was seeing that the css was generated fine, but the png had zero file size. My task looked like:
By adding in the algorithm as binary-tree, rather than using the default, all of a sudden png files and css generated correctly. Admittedly the sprites were fairly large one 5Mb and one 70Mb (152 images) - which is ridiculous but I was just trying to get something working.
I think if it is related to the size an error stating that files were too large to sprite with the algorithm would be cool - a silent fail makes me a bit nervous to use this in production.
The text was updated successfully, but these errors were encountered: