Git Product home page Git Product logo

grunt-strip-code's People

Contributors

johny-gog avatar nuzzio avatar philipwalton avatar richardartoul avatar spremi avatar zubb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grunt-strip-code's Issues

Stripping a File Gives Permissions Error Replacing Same File

I am using the following example..

strip_code: { // jshint ignore:line
options: {
start_comment: 'start-remove', // jshint ignore:line
end_comment: 'end-remove', // jshint ignore:line
},
src: 'dist/js/sohoxi.js'
},

In my grunt file i combine a bunch of files into a dist folder...
grunt.registerTask('default', ['revision', 'jshint', 'sass', 'concat', 'strip_code',

So the strip_code task runs after concat. No matter what i try i get the error Warning: Unable to write "src" file (Error code: EISDIR). Use --force to continue.

So it seems it is unable to strip and replace in the same file?

Problem with files array

Hi,

I'm getting an error when passing an array of files in the config object. This is how it looks

grunt.initConfig({

    strip_code : {
      options : {
        start_comment : 'start_remove_here',
        end_comment : 'end_remove_here'
      },
      files : [{src:"scripts/a.js", dest : "scripts/a-strip.js"},{src:"scripts/b.js", dest : "scripts/b-strip.js"}]
    },// strip_code end

  });// init config end

And this is the error I'm getting:

Warning: Object #<Object> has no method 'indexOf'

Any help will be appreciated.

Thanks,
Rodrigo.

src files do are not recursive

There doesn't seem to be a way to have the src be recursive - without this, it is useless for larger projects. Is this something that can be added?

grunt-strip-code subtask doesn't strip code

Hi,

I'm trying out the grunt-strip-code library and I'm running into an issue and I'm running into an odd issue where if I nest my grunt-strip-code config like so:

grunt.initConfig({
  strip_code: { 
    js: { /*... my settings */ }
  }
})

and run the grunt task (e.g. grunt strip_code:js) it doesn't seem to find my file. But removing the sub task allows me to run grunt-strip-code fine.

When I run the command in verbose mode I get this output:

Running "strip_code:js" (strip_code) task
Verifying property strip_code.js exists in config...OK
File: [no files]
Options: testMode=false, intersectionCheck, parityCheck, locale="en_us", patterns=[], blocks=[{"start_block":"/* start-test-block  end-test-block */"}], start_comment=false, end_comment=false, pattern=false, eol=""

I know this isn't a file path issue since removing the subtask block shouldn't affect what I define in your_target but any thoughts on what could be happening? Let me know if there is more information you need.

won't strip code

Hi,
love this tool! (on my pc)
But on my coworker's pc it just won't strip.

all i see is: No code was stripped from file: ...

we tried a lot of things like using the cmd as admin. installing over and over again. But i have no idea why it won't strip?

He uses a pc with win 10.

Inline tags strips newline outside of tags

When attempting to strip a portion of a line using inline tagging, the newline is also stripped. This happens even if trailing white space is added at the end of the line

Example:

const var1 = "123"
const var2 /*begin_strip_tag*/ = "This is a string I want removed" /*end_strip_tag*/

will result in:

const var1 = "123"const var2

I would expect:

const var1 = "123"
const var2 

grunt-strip-code places file under /src

Hi!
I'm trying out your Grunt plugin and have the following problem.
First of all, this is my strip_code configuration:

strip_code : {
  options : {
    pattern : /(\<\!--) @formatter:(off|on) -->/g
  },
  src : 'dist/index.html'
}

With this, I'm trying to remove IntelliJ's <!-- @formatter:on --> commands.
If I get your documentation right, the strip_code task should place the edited file on the same place which was defined in the src attribute, however, strip_code will save the new file as <root>/src.

I don't get what I'm doing wrong here.

FR: 2 checks that allow user to be more sure about code validness after plugin has been done its job

Lets say you have next code

//debug_start
"some code here";
//debug_start
...
//debug_start
"another debug code here";
//debug_end

Everybody know copy/paste is bad thing, but we still use it. So I would like to suggest
FR1: check if every "start" comment has its "end" pair

other example

//debug_start
"some code here";
//debug_start
"another code here";
//debug_end
"absolutely another code here";
//debug_end

In case any of *"code here" blocks contain half of '()' or '{}' debug may turn into nice quest :)
FR2: would be nice to have add check that forbids nesting of comments

I am newbie in grunt plugin development but I think would be nice to add those checks before actual replace and make them actually a required dependencies of replace (sub)task.

What do you think of this?

Invalid doc

Documentation (README.md) tells we can configure under strip_code whereas strip_code task is a multi task declaration.

This from doc is invalid:

grunt.initConfig({
  strip_code: {
    options: {
      start_comment: 'start-test-block',
      end_comment: 'end-test-block',
    },
    src: 'dist/*.js'
  },
})

This is valid:

grunt.initConfig({
  strip_code: {
    options: {
      start_comment: 'start-test-block',
      end_comment: 'end-test-block',
    },
    myTarget: {
        src: 'dist/*.js'
    }
  },
})

How to strip code only from production files?

I need test code to be stripped only from production files but remain in my source files. I could do concatenation to generate one file and then use the plugin to strip test code from it. But I use requirejs and I can't think of any way to achieve that. I need my sources to be already stripped from test code, because if run r.js first - it will delete all comments and I won't be able to use grunt-stip-code.
If I run grunt-strip-code first - I end up with my sources being stripped from test code and that's not what I want. Any ideas on how to achieve desired effect in this situation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.