coreui-free-bootstrap-admin-template icon indicating copy to clipboard operation
coreui-free-bootstrap-admin-template copied to clipboard

Cant' integrate CoreUi in a Symfony 6 project

Open SanChrisCC opened this issue 2 years ago • 4 comments

I'm trying to integrate the CoreUi Admin Bootstrap template in my first Symfony project.

But I have some issues. First, the sidebar doesn't work. I can't minimize it.

And I have a JS error in my console :

Action

Action in the code :

<button class="header-toggler px-md-0 me-md-3" type="button" onclick="coreui.Sidebar.getInstance(document.querySelector('#sidebar')).toggle()">
				<i class="icon icon-lg icon-2xl cil-menu"></i>
			</button>

Error console

This is my project tree :

Project tree

My app.js :

/*
 * Welcome to your app's main JavaScript file!
 *
 * We recommend including the built version of this JavaScript file
 * (and its CSS file) in your base layout (base.html.twig).
 */

// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.scss';

// start the Stimulus application
import './bootstrap';

import '@coreui/coreui';
import '@coreui/icons';

import 'simplebar';

My app.scss :

// @import "~bootstrap/scss/bootstrap";

@import "~@coreui/coreui/scss/coreui";
@import "~@coreui/icons";

$enable-ltr: true; /* stylelint-disable-line scss/dollar-variable-default */
$enable-rtl: true; /* stylelint-disable-line scss/dollar-variable-default */

// If you want to add custom CSS you can put it here.
@import "scss/custom";

I don't really understand whats's missing :(

SanChrisCC avatar Mar 11 '22 15:03 SanChrisCC

const coreui = require('./coreui-pro/dist/vendors/@coreui/coreui-pro/js/coreui.bundle.min');
global.coreui = coreui;

abunch avatar Apr 09 '22 17:04 abunch

Thanks @abunch for your response ! You put these lines in the app.js ?

SanChrisCC avatar Apr 11 '22 08:04 SanChrisCC

@SanChrisCC I did - this seemed to bootstrap most of the coreui functionality.

const coreui = require('./coreui-pro/dist/vendors/@coreui/coreui-pro/js/coreui.bundle.min');
global.coreui = coreui;
require('./coreui-pro/dist/vendors/simplebar/js/simplebar.min');
require('./coreui-pro/dist/vendors/@coreui/utils/js/coreui-utils');

abunch avatar Apr 16 '22 05:04 abunch

..Once you build the bootstrap admin template, move the entire directory into your assets directory ex., assets/coreui-pro then commit the whole thing (including the node_modules directory from the build) into your repo - treat it as a built asset.

abunch avatar Apr 16 '22 05:04 abunch

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 25 '23 23:04 stale[bot]