Giter Club home page Giter Club logo

gulp-inject-string's Introduction

Well hello there ๐Ÿš€

gulp-inject-string's People

Contributors

evanre avatar jbjorge avatar mikehazell avatar thedancingcode 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

Watchers

 avatar  avatar  avatar  avatar  avatar

gulp-inject-string's Issues

Replace injecting captured groups unintentionally

Hi! I'm using inject.replace to turn my webpack output into a single file. It works for the most part, except for the files that I've noticed have this string $& which is either generated by webpack or the package I'm using. This results in the search term being injected into the inject.replace result. Since that's what $& does in regex.

Is there a way to prevent this behavior? Thanks!

Replace deprecated dependency gulp-util

gulp-util has been deprecated recently. Continuing to use this dependency may prevent the use of your library with the latest release of Gulp 4 so it is important to replace gulp-util.

The README.md lists alternatives for all the components so a simple replacement should be enough.

Your package is popular but still relying on gulp-util, it would be good to publish a fixed version to npm as soon as possible.

See:

Error in directory

It's can't process directory.
Throw an error.
I read the source code.

// assume str is a string for now

Please fix

return es.map(function (file, cb) {
    if (!file.contents) {
      return cb(null)
    }

    try {
      file.contents = new Buffer(injectMethod(String(file.contents)));
    } catch (err) {
      return cb(new PluginError('gulp-inject-string', err));
    }

    cb(null, file);
  });

Replace is not working with block comments

Replace is not working with a block comment in scss, e.g. /*@replaceme*/. Regular comments are working. Example:

gulpfile.js:

return gulp
        .src('./styles.scss')
        .pipe(inject.replace('/*@replaceme*/', '123')) // No effect
        .pipe(inject.replace('//@replaceme', '345')) // Working
        .pipe(gulp.dest('./'))
    ;

styles.scss:
'/*@replaceme*/ //@replaceme

Add a custom method

Hi, I need to make something more difficult than just string replace. And I think about implementing custom method that will give us ability to make any manipulations with strings on javascript.

For example. I've faced with problem when on my gulp environment I've needed parse regex occurrence and return different strings. Here is my working code:
.pipe($.injectString.custom(function (str) { return str.replace(new RegExp('(z-var\\s*:\\s*)(\\w*)(.*;)', 'g'), function (match, g1, g2, g3) { return '{' + g2 + '}'; }); })

This function find and replace z-var: varName; to {varName}

Created a pull request. #12

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.