I am creating a skeleton base for my applications and I want to use Symfony 4 and Startbootstrap-SB-Admin .
I already have a skeleton project using Symfony 3
and SB-Admin-2
and another one with Silex
. These last ones I created using bower
within the document_root .
Now I'm using Yarn and WebPack through Webpack Encore .
I am having difficulty integrating the required libs from SB-Admin into CSS and JS.
I installed Node 8, Yarn, and then executed the commands below in Windows.
yarn add popper.js
yarn add @symfony/webpack-encore --dev
yarn add sass-loader node-sass --dev
yarn add jquery --dev
yarn add bootstrap-sass --dev
yarn add startbootstrap-sb-admin --dev
The modules were included in ~ node_modules / *
NOTE: I am using Vagrant with a shared Windows / Linux directory and on Linux the Yarn commands try to create symlinks for the webpack which is not supported by the filesystem generating the error below.
error An error occurred: "EPROTO: protocol error, symlink '../../../../webpack/bin/webpack.js '->' /vagrant/skel/node_modules/@symfony/webpack-encore/node_modules/.bin/webpack '"
Below some lines of the files
~ templates / layout.html.twig
<!-- Application CSS -->
<link rel="stylesheet" href="{{ asset('build/app.css') }}">
<!-- App main JS -->
<script src="{{ asset('build/app.js') }}"></script>
~ assets / js / app.js
require('../css/app.scss');
var $ = require('jquery');
require('bootstrap-sass');
require('startbootstrap-sb-admin/scss/sb-admin.scss');
~ assets / css / app.scss
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
$fa-font-path: "~font-awesome/fonts";
$brand-primary: darken(#428bca, 20%);
@import '~bootstrap-sass/assets/stylesheets/bootstrap';
// Tentei usar import aqui
// @import '~startbootstrap-sb-admin/scss/sb-admin.scss';
PROBLEM
I've included the following line in my .js
file in my assets
require('startbootstrap-sb-admin/scss/sb-admin.scss');
When I run c:\projetos\skel> yarn run encore dev
everything works fine, but I do not understand the inclusion of CSSes or theme JSes in compiled final files.