Giter Site home page Giter Site logo

gulp-delete-lines's People

Contributors

adriennn avatar carstenschaefer avatar yodasws avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-delete-lines's Issues

Bug creating douplicating lines if several filters are set

Hey,

it seems like your code has a major bug producing douplicates of valid lines of more than one filter is set:

     for (_j = 0; _j < opt.filters.length; _j++) {
        if (! lines[_i].match(opt.filters[_j])) {
            newLines.push(lines[_i]);
        }
      }

In the inner for loop you have to check if the line was already added or if better would be to add it in the first place and remove it if one of the filters match.
If you don't do this the line will be added for every filter that doesn't match.

Greetz

David

remove gulp-util

https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

remove gulp-util using the following API replacements:

gutil.File => https://www.npmjs.com/package/vinyl
gutil.replaceExtension => The .extname property on Vinyl objects or https://www.npmjs.com/package/replace-ext
gutil.colors => https://www.npmjs.com/package/ansi-colors
gutil.date => https://www.npmjs.com/package/date-format
gutil.log => https://www.npmjs.com/package/fancy-log
gutil.template => https://www.npmjs.com/package/lodash.template
gutil.env => https://www.npmjs.com/package/minimist
gutil.beep => https://www.npmjs.com/package/beeper
gutil.noop => https://www.npmjs.com/package/through2
gutil.isStream => Use the .isStream() method on Vinyl objects
gutil.isBuffer => Use the .isBuffer() method on Vinyl objects
gutil.isNull => Use the .isNull() method on Vinyl objects
gutil.linefeed => Use the string '\n' in your code
gutil.combine => https://www.npmjs.com/package/multipipe
gutil.buffer => https://www.npmjs.com/package/list-stream
gutil.PluginError => https://www.npmjs.com/package/plugin-error

Choosing multiple regex in the filters array not working

Hello,

Below is a code of how I've currently setup this function. For some reason on compilation the lines aren't being removed.

// ...
.pipe(deleteLines({
    'filters': [
        /<base\s+href=["']/i,
        /<script\s+src=["']https:\/\/ajax\.googleapis\.com\/ajax\/libs\/jquery\/1\.12\.2\/jquery\.min\.js["']/i
    ]
}))
// ...

However, when I reduce the array to 1 item like below, it works.

// ...
.pipe(deleteLines({
    'filters': [
        /<base\s+href=["']/i
    ]
}))
// ...

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.