Note (edit): This works with the cli version. If you are using jspm, you should not need any special management of the library (see my comment for details).
Based on JayDi's really nice FontAwesome work mentioned above, I created the following that I will leave here for those who don't yet fully understand what this is doing or how it works:
In your \aurelia_project\tasks
folder, create a file called prepare-images.js
and add the following code:
import gulp from 'gulp';
import merge from 'merge-stream';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
export default function prepareImages() {
const taskImages = gulp.src( 'src/resources/images/*' ) //use the file path to your image folder (this is where I put mine)
.pipe( changedInPlace( { firstPass: true } ) )
.pipe( gulp.dest( `${project.platform.output}/images` ) );
return taskImages;
}
Then, in your \aurelia_project\tasks\build.js
folder add the following lines of code:
import project from '../aurelia.json';
import prepareFontAwesome from './prepare-font-awesome';
import prepareImages from './prepare-images'; //add this line
export default gulp.series(
readProjectConfiguration,
gulp.parallel(
transpile,
processMarkup,
processCSS,
prepareFontAwesome,
prepareImages //add this line
),
writeBundles
);
You can now place your images in your folder (e.g. /src/resources/images
), and they will be available in your build project at /scripts/images/your_file_name
.