outaTiME / grunt-replace

Replace text patterns with applause.
MIT License
411 stars 47 forks source link

Error while processing "some/file.html" file. Use --force to continue #72

Closed seyDoggy closed 9 years ago

seyDoggy commented 9 years ago

What am I doing wrong here?

I make a config and task:

replace: {
    options: {
        patterns: [{
            match: 'VIEWONLINE',
            replace: '<%= paths.target %>/<%= paths.saveas %>'
        }]
    },
    dist: {
        files: [{
            expand: true,
            cwd: '<%= paths.src %>',
            src: '<%= paths.email %>',
            dest: '<%= paths.dist %>/'
        }]
    }
}

...

grunt.registerTask('test', 'a test runner', function () {
    grunt.task.run([
        'replace',
    ]);
});

Then I run it:

$ grunt test
unning tasks: test

Running "test" task

Running "replace" task

Running "replace:dist" (replace) task
Verifying property replace.dist exists in config...OK
Files: app/index.html -> dist/index.html
Options: encoding="utf8", mode=false, processContentExclude=[], patterns=[{"match":"VIEWONLINE","replace":"/index.html"}], excludeBuiltins=false, force, verbose
Reading app/index.html...OK
Processing source...ERROR
Warning: Error while processing "app/index.html" file. Use --force to continue.

Aborted due to warnings.

But it fails.

outaTiME commented 9 years ago

hi pal,

mmmm strange scenario, the grunt-replace were looking for @@VIEWONLINE tag in app/index.html file, but i dont know why it brokes ...

What contents got your index.html file ??

outaTiME commented 9 years ago

oups, wait a minute ...

the patterns way are:

patterns: [{
  match: 'VIEWONLINE',
  replacement: '<%= paths.target %>/<%= paths.saveas %>'
}]

replacement attribute and NOT replace ...

outaTiME commented 9 years ago

probably it solves your issue ... thks !

seyDoggy commented 9 years ago

O... M... G...

hanfeisun commented 9 years ago

same issue.. solved...