alanshaw / grunt-include-replace

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

Can't use `/* @@` and ` */` As prefix and suffix? #15

Closed SimplGy closed 11 years ago

SimplGy commented 11 years ago

Mostly looking for confirmation--Is it true that I can't use JS comments to contain my includes?

Works:

includereplace:
  options:
    prefix: '<!-- @@'
    suffix: ' -->'

Does not work:

includereplace:
  options:
    prefix: '/* @@'
    suffix: ' */'

Is this because those characters are incompatible with the regex used to find the replacement areas?

alanshaw commented 11 years ago

Is it true that I can't use JS comments to contain my includes?

No, but you'll need to escape your prefix/suffix if you want to.

If you want to say:

/* @@ include("foo.js") */

Your prefix/suffix should look like:

options: {
  prefix: "\\/\\* @@ ",
  suffix: " \\*\\/"
}
SimplGy commented 11 years ago

I see, that makes great sense, thanks!