These are chat archives for brunch/brunch

3rd
Aug 2016
Mauro Oviedo
@moviedo
Aug 03 2016 14:40
@adrianmc yes i read up on the issue, makes sense
if I wanted to contrib, would I fork your branch?
Adrian Li
@adrianmcli
Aug 03 2016 16:24
@moviedo sure! since I haven't received word from the official Brunch people, I guess we can work off of my fork for now :smile:
Mauro Oviedo
@moviedo
Aug 03 2016 16:24
cool
Adrian Li
@adrianmcli
Aug 03 2016 16:25
glad you want to help :+1:
Adrian Li
@adrianmcli
Aug 03 2016 17:25
I just tried to look into whether or not we can refer to an external config file for brunch.
Unfortunately the answer is no. It used to be a feature, but it was deprecated in favour of having just the one config file.
More details in the issue: brunch/brunch#1466
Colin Bate
@colinbate
Aug 03 2016 18:32
You are still going to run into the plugin issue that I mentioned on github about the transitive dependencies (unless you are adding them directly to that project's package.json)
Mauro Oviedo
@moviedo
Aug 03 2016 18:32
yeah, I saw
was reading the comments
Colin Bate
@colinbate
Aug 03 2016 18:33
yea, I just went on a bit of a rant...
Mauro Oviedo
@moviedo
Aug 03 2016 18:33
@adrianmc I think the best thing to do with the create-react-app project would be to update the eject command
and create a configured brunch project based on the create-react-app file structure
Adrian Li
@adrianmcli
Aug 03 2016 18:34
but are we giving up on having start and buildbe run by Brunch?
Mauro Oviedo
@moviedo
Aug 03 2016 18:35
seems to me the most difficult part that new devs would face when working with react would be the eject process
Adrian Li
@adrianmcli
Aug 03 2016 18:35
and simply have the current CRA eject to a Brunch app instead?
Colin Bate
@colinbate
Aug 03 2016 18:35
I see that as more illustrative since there are bound to be inconsistencies between the pre-ejected Webpack version and the ejected Brunch version, even if they are minor
Adrian Li
@adrianmcli
Aug 03 2016 18:35
this is kinda discouraging. it's like... why don't we just recommend ppl start off with Brunch
Mauro Oviedo
@moviedo
Aug 03 2016 18:36
that would be nice @adrianmc
Adrian Li
@adrianmcli
Aug 03 2016 18:37
lol, too bad we don't live in an ideal world
Colin Bate
@colinbate
Aug 03 2016 18:38
It is discouraging in a sense, but I see it as encouraging in the sense that Brunch already does this, and while you could hide away things a little bit more perhaps, I'm not sure that is worth it
Adrian Li
@adrianmcli
Aug 03 2016 18:38
btw, @colinbate I like what you said there about rewriting CRA as a simple wrapper around Brunch
Colin Bate
@colinbate
Aug 03 2016 18:38
I already use Brunch to spin up quick little projects all the time
with React or not
Adrian Li
@adrianmcli
Aug 03 2016 18:39
same here. I'm just trying to figure out the best way to reach the mainstream React/JS media
Colin Bate
@colinbate
Aug 03 2016 18:39
People tell me they prefer my ng2-brunch skeleton to the Angular 2 CLI tool because it actually works :)
Adrian Li
@adrianmcli
Aug 03 2016 18:41
haha, nicely done. I really believe Brunch has a lot to offer to the broader js-dev community.
Mauro Oviedo
@moviedo
Aug 03 2016 18:41
i certainly agree with the above statement
Colin Bate
@colinbate
Aug 03 2016 18:41
@adrianmc You could try doing the wrapper route and then just making it a brunch project to start with.
with skeleton and config matching the CRA one
and put that out there, the only problem is that the brunch-config to accommodate the different conventions would be a bit scarier than normal
If you wanted to be more CRA like, you could have the config bundled in a separate package and then do something really hacky like copying it into place when you run the brunch commands :/
Adrian Li
@adrianmcli
Aug 03 2016 18:45
yeah, I mean... hiding the config file isn't REALLY necessary because we all know how much simpler Brunch config files are when compared to Webpack
copying the config in at runtime is hacky, but doable, but then again I'm sure u'll all agree that it's probably better to leave the Brunch config file in there as a testament to show how simple the config files can be
Colin Bate
@colinbate
Aug 03 2016 18:48
yes, but it gets less simple when you want to break conventions. Ultimately it almost feels like Brunch belongs in this list: https://github.com/facebookincubator/create-react-app#alternatives
Adrian Li
@adrianmcli
Aug 03 2016 18:48
I feel that one big problem with CRA is that it tries to abstract too much away from newbies. They basically no exposure to config files, and no way to change or tweak anything. At the current stage, it feels that CRA is useless other than as a tutorial tool for beginners.
Mauro Oviedo
@moviedo
Aug 03 2016 18:49
yes, I agree
Colin Bate
@colinbate
Aug 03 2016 18:49
oh yea, you'd need to eject for anything other than toy projects
and then you have to deal with Webpack
Adrian Li
@adrianmcli
Aug 03 2016 18:50
what frustrates me sometimes is that everyone assumes you NEED to learn Webpack if you want to do React beyond the level of simple tutorials.
I'm going to start a new project called create-react-app-brunch as a concept/demo project. I'll tag you guys when I have something up. Maybe you'd like to contribute :smile:
it'll be the wrapper we talked about. essentially it's a marketing project for using React with Brunch.
If you have better name suggestions, feel free to let me know!
Mauro Oviedo
@moviedo
Aug 03 2016 18:52
sure
Colin Bate
@colinbate
Aug 03 2016 18:52
yea, sounds good
Adrian Li
@adrianmcli
Aug 03 2016 18:52
awesome
thx for the input guys
Adrian Li
@adrianmcli
Aug 03 2016 22:14
@colinbate @moviedo I've made a Hello World effort here: adrianmc/create-react-app-brunch
right now, all it does is create a regular Brunch app. I'm not even sure if I'm doing it right.
Jackson Ray Hamilton
@jacksonrayhamilton
Aug 03 2016 22:44

Hi, does anyone have an idea for how I could configure brunch to include an arbitrary snippet of JS inside a JS file depending on the build environment?

Background: I have a deployment-specific JSON configuration object that I want to pass to my application. I'd rather not inject this into e.g. a handlebars template (like <script>CONFIG = {{config}}</script> or <input value="{{config}}">) because the object could potentially significantly increase the size of the HTML document.

Jackson Ray Hamilton
@jacksonrayhamilton
Aug 03 2016 22:56

Also, I couldn't help but catch myself up with the above conversation. Great work @adrianmc, recreating CRA in 24 lines!

After years of hopelessly complex Grunt, Gulp and WebPack configuration files (and even directories), discovering Brunch was a big relief. The first thing I thought when I read the CRA debut post was, "Brunch!"

Jackson Ray Hamilton
@jacksonrayhamilton
Aug 03 2016 23:02
And 24 lines is hardly an overstatement because with-react was also miniscule.
Mauro Oviedo
@moviedo
Aug 03 2016 23:45
@jacksonrayhamilton you can update the regex to specifically for production vs dev by using the overrides config option
overrides: {
  production: {
javascripts: {joinTo: ‘updated regex’},
  }
}
etc