alanshaw / grunt-include-replace

Grunt task to include files and replace variables. Allows for parameterised includes.
MIT License
200 stars 45 forks source link

Replace original files #42

Closed benplum closed 10 years ago

benplum commented 10 years ago

Adds the ability to replace the original files. Useful when replacing strings / files in place.

alanshaw commented 10 years ago

Can you not achieve this by simply specifying the source and destination directory to be the same?

benplum commented 10 years ago

I tried that before forking, it creates a sub directory inside the source directory:

includereplace: {
    all: {
        options: {
            prefix: '@',
            globals: '<%= pkg.vars %>'
        },
        dest: 'js/',
        src: 'js/*.js'
    }
}

Creates:

js/js/site.js

I'm open to other implementations.

alanshaw commented 10 years ago

Could you do something like:

includereplace: {
    all: {
        options: {
            prefix: '@',
            globals: '<%= pkg.vars %>'
        },
        dest: 'js/',
        src: '*.js',
        expand: true,
        cwd: 'js/'
    }
}

See http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically for more info

benplum commented 10 years ago

It does indeed work, I thought I had tried that but must have been mistaken. Anyway, thanks for the great plugin!