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

Replace not working with multiple files. #299

Open
ZeroThe2nd opened this issue Dec 21, 2017 · 0 comments
Open

Replace not working with multiple files. #299

ZeroThe2nd opened this issue Dec 21, 2017 · 0 comments

Comments

@ZeroThe2nd
Copy link

ZeroThe2nd commented Dec 21, 2017

Having my copy object written for multiple files as in the docs, but adding the process option, does not work as it should. The files get copied, but not modified. When not using the files but defining a single file as per the docs, the copy and replace works, but for one file only.

I'm running the folloing:

  • grunt-contrib-copy v1.0.0
  • Linux Mint 18
  • grunt-cli v1.2.0
  • grunt v1.0.1
  • npm v5.6.0
  • nodejs v8.9.3

Copy section from gruntfile.js

copy   : {
    main : {
        files : [
            {                src     : 'assets/js/app.js',
                dest    : 'dist/assets/js/app.build.js',
                options : {
                    process : function(content, srcpath) {
                        return content.replace(/(\.css')/g, '.min.css\'');
                    },
                },
            },
            {
                src     : 'index.html',
                dest    : 'dist/index.html',
                options : {
                    process : function(content, srcpath) {
                        return content.replace('assets/js/app.js', 'assets/js/app.min.js');
                    },
                },
            },
            {
                src  : 'assets/js/Helper.js',
                dest : 'dist/assets/js/Helper.build.js',
            },
            {
                expand : true,
                src    : [
                    '/assets/audio/**',
                    '/assets/icons/**',
                    '/assets/images/**',
                ],
                dest   : 'dist/assets',
                filter : 'isFile',
            },
        ],
    },
},
@ZeroThe2nd ZeroThe2nd changed the title Replace not working with multiple files, not copying others. Replace not working with multiple files. Dec 21, 2017
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

1 participant