question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow transforms to be configured with options

See original GitHub issue

I’ve been messing around with my own transforms and see a lot of potential for them to replace certain grunt tasks I have, but I’d need to be able to pass them additional options.

I originally tweeted something along the lines of this on twitter and @substack replied saying currently the best way is using environment variables: https://twitter.com/substack/statuses/410566575117185024

I imagine them too look something like this:

browserify: {
  transforms: [
    "coffeeify",
    {name: "ngtemplateify", module: "mod"}
  ]
}

Also regarding transforms, perhaps it would be good to be able to turn off module level transforms from these options, for example, lets say I’m using some special transforms that are in my karma config:

browserify: {
  transforms: [
    {name: "coffeeify", disable: true},
    // not a published transform yet, but would use Ibrik to add 
    // coverage and at the same time convert coffee files to javascript
    {name: "ibrikify"} 
  ]
}

In that case, if I had a module level transform specifying “coffeeify”, my “ibrikify” transform would already have converted the coffee files to js and when the module level transform was applied it would throw an error. So, this would solve that problem without having to expose something like transformKey as a browserify option to be able to set it to false ignoring all module level transforms.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:47 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
StreetStridercommented, Jun 11, 2014

So when one want to use parametric transformations in package.json one should use some third-party module? Which third-party module should be used for that?

I think this issue must be illuminated in readme. This is important, because when someone uses browserify programmaticaly (for instance, in gulpfile or his own build script) parametric transforms can be used, but package.json could not provide such feature. In second case one will rely only on non-parametric transformations.

0reactions
jwaltoncommented, Apr 12, 2018

The “configuring transforms” landscape has changed quite a bit since this conversation took place. From the README:

Transforms may obtain options from the command-line with subarg syntax:

$ browserify -t [ foo --bar=555 ] main.js

or from the api:

b.transform('foo', { bar: 555 })

If you’re writing a transform, (it’s been a while since I did this so I might have this wrong) I’m pretty sure it’s just a function transform(file, config) {...}. This seems to be where my browserify-transform-tools library gets it from. 😛

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.Net Web Application Add Config Transform Grayed Out
How to enable "Add Config Transform" option. Please follow the below steps. Step1: Go to Solution configuration (Below Team) Go to Solution configuration...
Read more >
Web.config Transformation Syntax for Web Project ...
A transform file is an XML file that specifies how the Web. config file should be changed when it is deployed. Transformation actions...
Read more >
transform - CSS: Cascading Style Sheets - MDN Web Docs
The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual ...
Read more >
Options - Babel.js
Placement: Allowed in Babel's programmatic options, or inside of the loaded "configFile" . A programmatic option will override a config file one. true...
Read more >
Code Transformation - Jest
Jest supports this via the transform configuration option. A transformer is a module that provides a method for transforming source files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found