I'm trying to set a Fuse-box environment to be able to bundle JQuery, Boostrap and ionicons packages into two files:
- static/assets/js/bundle.js
- static/assets/css/bundle.css
I have two problems:
- My JQuery script doesn't work.
- CSSResourcePlugin generates no resource files, so ionicons aren't shown.
My fuse.js file is set as follows:
const fuse = FuseBox.init({
homeDir: 'src/',
output: 'static/$name.js',
plugins: [
[
SassPlugin({ importer: true }),
CSSResourcePlugin({
dist: 'static/assets/resources',
resolve: f => `assets/resources/${f}`
}),
CSSPlugin({
group: 'bundle.css',
outFile: `static/assets/css/bundle.css`
})
]
],
shim: {
jquery: {
source: 'node_modules/jquery/dist/jquery.js',
exports: 'jQuery'
}
}
});
fuse.dev({ httpServer: true, hmr: true, port: 3000 });
fuse.bundle('assets/js/bundle').instructions('>index.ts').watch().hmr();
fuse.run();
My typescript files:
index.ts
import 'tether';
import 'bootstrap';
import './ts/sliders';
import './app.scss';
./ts/sliders.ts
import * as $ from 'jquery';
import 'slick-carousel';
$(function() {
console.log('dede');
});
My app.scss file:
@import './scss/custom.scss';
@import '~bootstrap/scss/bootstrap.scss';
@import '~ionicons/dist/scss/ionicons.scss';
@import '~slick-carousel/slick/slick.scss';
@import '~slick-carousel/slick/slick-theme.scss';
The whole project is available on Github: https://github.com/jezikk/fuse-box-test
Can you please help me with settings?
Make sure that resource files reachable (sometimes they are not) It's easier if you import the actual
dist
from bootstrap.