I am trying to use Aurelia with Symfony backend. Part of our application is generated on the backend (good, old server-side MVC) and part of it should be an SPA. I have started aurelia app from skeleton-typescript (JSPM). Directory structure I am trying to create is as follows.
project/
src/
SomeModule/
SomeOtherModule/
FrontendModule/
build/
src/
app.ts
main.ts
...
index.html
package.json
...
web/
dist/
I have changed the output path in build/paths.js
and gulp build
correctly places the compiled files in the web/dist
. I have also added a gulp task that copies the index.html
into the web/
.
The biggest problem I have is how to manage the JSPM dependencies. If I configure it to downlad the dependencies into web/jspm_dependencies
, the application works when launched with Symfony but I am not able to configure karma unit tests properly (it says for example that it can't find aurelia-polyfills). If I leave the jspm_dependencies
in the src/FrontendModule
then I have to create a gulp task that copies it to the web/
and it takes a lot more than 10s => unacceptable.
This leds me to the following questions:
- What is the suggested directory structure for Aurelia project when I am not going to serve the app from the project's root?
- Is there any way to copy only the files needed by the application to the
web/
(something like main-bower-files for bower)?
I know I can gulp export
the app into the web/
, but I want to use the same directory structure during the development, too.
I don't want to use browsersync server in the dev because of multi-nature of the application (SPA part and non-SPA part that has to be served from "real" backend).