The first examples are fairly contrived and not that useful. We'll want to be able to work with multiple trees, and ultimately have them written to our target directory.
yarn add --dev broccoli-merge-trees@^3.0.0
Now let's add a some directories and content so we can ship unprocessed assets like images, css and js:
mkdir -p public/images
alert("Eat your greens");
public/images add this image, named
Again, pretty simple. We've added 2 filters for our
css, that's taken an input node
appRoot, filtered out
all files except the
app.css and will copy the files to the
/assets within the target
We've also added a
public filter, that merely copies the contents of
/public and added it to the output directory.
Then, we take all these nodes, and merge them together, so all files end up in the target directory.
yarn serve, refresh your browser and you should get an alert message saying
Eat your greens with a nice pale
yarn build the target
dist directory should contain:
Completed Branch: 03-merge-trees