Giter Club home page Giter Club logo

broccoli-replace's Introduction

Hi there ๐Ÿ‘‹

broccoli-replace's People

Contributors

alexbaizeau avatar joliss avatar makepanic avatar outatime avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

broccoli-replace's Issues

Allow replacement function to access the relativePath

This plugin is just what I need - except part of what I need to replace in my file is the relative path to the file being processed (for a <script> tag insertion based on the current directory).
Could you provide some config to make this possible?

Note, the processString method

ReplaceFilter.prototype.processString = function (string) {

takes the relativePath as a second parameter, so this doesn't seem too hard to wire up in that location (no change to applause)

Version 2.0.0+ modifies binary files

I have the following code:

new BroccoliReplace(new Funnel('node_modules/node-viewerjs/release', { destDir: '/ViewerJS' }), {
  files: ['**/*.js'],
  patterns: [{ match: /ODFViewerPlugin_css/, replacement: '""' }],
}),

The idea is that I want the files from node_modules/node-viewerjs/release copied in the release and then in the JS files this string to be replaced. There are also images in this directory which shouldn't be touched. This worked fine until version 2.0.0 (of course new BroccoliReplace was just BroccoliReplace). 2.0.0 and 2.0.1 modify the image files somehow.

Am I doing something wrong or is this a bug?

Replacement happens only once

I try to use broccoli-replace as some kind of a template engine (to replace @@include with partial HTML content).

But I cannot use it like that because replacement happens only once. On the initial build. How can I fix that?

Possible to insert non-stringified replacement?

e.g. I'd like

<head>
  {{testFiles}}
</head>

replaced with:

<head>
  var testFiles=['tests/foo.js, 'tests/bar.js'];
</head>

I'm able to get that with this configuration:

const testFiles = `['some/path', 'another/path']`;

const testHTML = new Replace('tests', {
  files: ['**/*.html'],
  patterns: [
    {
      match: /{{testFiles}}/,
      replacement: `<script>var testFiles=${testFiles};</script>`
    }
  ]
});

Which is OK but I have to 'pre-stringify' the array I'd like to insert.

I'm curious on your thoughts w/ supporting inserting Objects or Arrays as-is.

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.