Skip to content
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

manifest contains folder names #26

Open
marcorinck opened this issue May 13, 2013 · 11 comments
Open

manifest contains folder names #26

marcorinck opened this issue May 13, 2013 · 11 comments

Comments

@marcorinck
Copy link

I have updated a project from grunt 0.3.x to 0.4.1 and grunt-contrib-manifest from 0.2 to the current version 0.4.0.

Now my appcache manifest contains not only files but directory names too which the browser can't download of course.

The configuration is basically the same as it was before and looks like this:

manifest: {
            generate: {
                options: {
                    basePath: "<%=pkg.folders.build + pkg.name + '-' + pkg.version%>",
                    network: ["*"],
                    fallback: [],
                    exclude: [],
                    preferOnline: false,
                    timestamp: true
                },
                src: [
                    "**/*"

                ],
                dest: "<%= pkg.folders.build + pkg.name + '-' + pkg.version%>/hwa-mobile.manifest"
            }
        },

I have tried different src-Strings but I can't get it to work that automatically ALL of the files (and only files) are included. I could manually exclude the folders but I don't want to change the buildfile every time something changes in folder structure.

Any hints?

Thanks!
Marco

@ertrzyiks
Copy link

I went into the same problem and had to add extension to filter

"js//*.js",
"css/
/*.css",

This is not convenient way when caching images though ^^

@marcorinck
Copy link
Author

The only solution I got was to exclude the folders names manually like this:

**/*,
!css,
!js,
!images

Would like to know a solution which works automatically.

@honi
Copy link

honi commented May 29, 2013

Having the same problem here.

I've forked the repo and made some changes so that the manifest task uses Grunt internal file mapping to build the cache file list. There is no need to include custom options, like basePath or exclude, since this is already handled by Grunt.

Now you can use cwd and filter options to build the src list, as described here. Note that you shouldn't use expand == true for this to work (contrary to what the docs say), since that will try to generate a manifest file for each src file found.

For example:

cwd: 'path/to/src/files',
src: ['**/*.html', '**/*.js'],
filter: 'isFile'

Will output only .html and .js files in path/to/src/files directory, and the file path won't include path/to/src/files.

@gunta, if you like this approach, I would be happy to send you a pull request.

@gillesdemey
Copy link

I'm also having the exact same problem causing me to manually edit the manifest file whenever I build my application.

Excluding the folders manually works fine, but requires me to edit the Gruntfile each time I add a folder.

@jeandat
Copy link

jeandat commented Aug 8, 2013

I'm in phase with honi. I tried that too but obviously, the plugin is not compatible with grunt files mechanism. That's too bad as this is really the core of grunt. Would be glad to be able to filter folders without having to explicitly write them.

@honi
Copy link

honi commented Aug 8, 2013

@jan4dev if you want you can check my fork which uses grunt's internal file mapping.
@gunta any interest in me sending the pull request?

@gunta
Copy link
Owner

gunta commented Aug 12, 2013

@heni, yes, it would be welcomed

@lread
Copy link

lread commented Aug 27, 2013

All of my filenames have an extension and none of my folders have a period in them so this worked for me:

src: [ '**/*.*' ]

@ryandotsmith
Copy link

@honi Can you submit a PR? I would love to see this improvement integrated into the project.

@gunta Would you cut a new release if @honi made a PR?

@honi
Copy link

honi commented Nov 27, 2013

I already did some time ago: #30

@gunta
Copy link
Owner

gunta commented Apr 28, 2014

See #48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants