Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding bootstrap in Symfony 4

In my Symfony 4 project, I try to add bootstrap as an import after

yarn add bootstrap --dev

As I follow documentation, I tried to import bootstrap as follows:

@import "~bootstrap/scss/bootstrap";

When I run yarn encore dev, it says module not found.

Than I tried this:

@import "../../node_modules/bootstrap/scss/bootstrap.scss";

The output is:

Syntax Error: ModuleNotFoundError: Module not found: Error: Can't resolve './alert' in 'C:\Users\tolga\GIT\artifex\node_modules\bootstrap\scss'

What am I missing? alert.scss is there but it cannot find module. What should I try?

like image 952
tolga Avatar asked Dec 31 '22 14:12

tolga


2 Answers

It seems I somehow solved the problem. First of all the import directory is this:

@import "../../node_modules/bootstrap";

I don't know why tilde didn't work. Adding sass-loader didn't help.

like image 85
tolga Avatar answered Jan 08 '23 01:01

tolga


Old subject but the solution is to change the extension of file app.css to app.scss.

like image 33
FrenchDev Avatar answered Jan 08 '23 02:01

FrenchDev