Has anyone rolled gulp into apostrophe for compiling assets? I'd like to use ES6, as I'm using a frontend framework that has all of the js nicely split up into separate assets, and have the compilation of that into one minified file part of the normal apostrophe build process (I'm using apostrophe-assets to reference a single root js file which imports everything else).
Asked
Active
Viewed 192 times
1 Answers
1
Great question. You're going to want to build your JavaScript with Gulp into one file before pushing that file to the browser using Apostrophe's asset pipeline.
For example you might have a /src
directory at the root of your project that has your JavaScript files. You can pipe these files into your apostrophe-assets
directory or some other named directory that is a subclass of apostrophe-module
in /lib/modules/
.
You can then push your compiled file to the browser as usual: http://apostrophecms.org/docs/tutorials/getting-started/pushing-assets.html#configuring-java-script-for-the-browser

Austin Starin
- 21
- 3
-
Sorry, but that didn't quite solve my question - I was hoping to incorporate this process into the asset pipeline without the extra step. I can definitely run gulp before I start apostrophe up, but was looking to eliminate a step or automate that. – dgwebb Apr 06 '17 at 17:04
-
You could run Gulp and your Node server in parallel with an npm script so that there isn't an extra step. – Austin Starin Apr 10 '17 at 19:27
-
In series, rather, but yep, "npm start" scripts (see package.json documentation) are the way to do this, rather than integrating everything possible into Apostrophe's core. – Tom Boutell Apr 13 '17 at 23:38