Skip to content

Commit

Permalink
no bootstrap spartacus installation (#19797)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpawelczak authored Jan 8, 2025
1 parent 2f39a22 commit 7e87602
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 57 deletions.
4 changes: 2 additions & 2 deletions docs/migration/2211_ng18/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
styles to be applied correctly.
### Steps to Update:
1. Place the following import for styles-config at the top of the file:
```@import 'styles-config';```
```@import 'styles-config';```
2. Add Spartacus core styles first. Importing Spartacus styles before Bootstrap ensures core styles load as a
priority.
3. Follow this by importing Bootstrap styles using the Bootstrap copy provided by Spartacus. Ensure the order of
Bootstrap imports matches the sequence below for consistency.
4. Conclude with the Spartacus index styles.


Final file structure should look like this:
Final file structure should look like this:

```styles.scss
// ORDER IMPORTANT: Spartacus core first
Expand Down
1 change: 0 additions & 1 deletion extra-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
],
resolve: {
fallback: {
bootstrap: path.join(__dirname, 'projects/styles/bootstrap-copy'),
'@spartacus/styles': path.join(__dirname, 'projects/storefrontstyles'),
'@spartacus/user': path.join(__dirname, 'feature-libs/user'),
'@spartacus/organization': path.join(
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/cart/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
@import '@spartacus/styles/scss/cxbase/blocks/modal';
@import '@spartacus/styles/scss/misc/table';

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@mixin visible-focus {
outline-style: solid;
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/checkout/_index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import '@spartacus/styles/scss/core';

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/mixins';

@import './base/index';
@import './b2b/index';
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/organization/_index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import '@spartacus/styles/scss/core';

// we require a few bootstrap files for the CSS in this code
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@mixin visible-focus {
outline-style: solid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%buttons {
@import 'bootstrap/scss/buttons';
@import '@spartacus/styles/vendor/bootstrap/scss/buttons';
a.link,
button.link {
@extend .btn, .btn-link, .btn-sm;
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/pickup-in-store/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ $cx-color-link-primary: #1672b7;
@import '@spartacus/styles/scss/cxbase/blocks/modal';
@import '@spartacus/styles/scss/misc/table';

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@import './styles/index';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%cx-my-preferred-store {
@import 'bootstrap/scss/buttons';
@import '@spartacus/styles/vendor/bootstrap/scss/buttons';

.cx-store-opening-hours-toggle {
@include type('6');
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/product-multi-dimensional/_index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '@spartacus/styles/scss/core';
// we require a few bootstrap files for the CSS in this code
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@import './selector/index';
6 changes: 3 additions & 3 deletions feature-libs/product/_index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import '@spartacus/styles/scss/core';
// we require a few bootstrap files for the CSS in this code
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@mixin visible-focus {
outline-style: solid;
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/qualtrics/_index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '@spartacus/styles/scss/core';
// we require a few bootstrap files for the CSS in this code
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@import './styles/index';
6 changes: 3 additions & 3 deletions feature-libs/quote/_index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import '@spartacus/styles/scss/core';
@import '@spartacus/styles/scss/app';

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@mixin visible-focus {
outline-style: solid;
Expand Down
6 changes: 3 additions & 3 deletions feature-libs/storefinder/styles/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/mixins';

@import './components/index';
@import './layout/index';
6 changes: 3 additions & 3 deletions integration-libs/epd-visualization/_index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import '@spartacus/styles/scss/core';

@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@import './styles/index';

Expand Down
6 changes: 3 additions & 3 deletions integration-libs/opf/_index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import '@spartacus/styles/scss/core';
@import '@spartacus/checkout';
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';
@import './base/styles/index';
@import './checkout/styles/index';
@import './cta/styles/index';
Expand Down
21 changes: 20 additions & 1 deletion projects/schematics/src/add-spartacus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,26 @@ function installStyles(options: SpartacusOptions): Rule {
styleFilePath
);
let insertion =
`\n@import '${relativeStyleConfigImportPath}';\n` +
`@import '${relativeStyleConfigImportPath}';\n` +
`\n// ORDER IMPORTANT: Spartacus core first\n` +
`@import '@spartacus/styles/scss/core';\n\n` +
`// ORDER IMPORTANT: Copy of Bootstrap files next\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/reboot';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/type';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/grid';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/utilities';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/transitions';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/dropdown';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/card';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/nav';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/buttons';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/forms';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/custom-forms';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/modal';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/close';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/alert';\n` +
`@import '@spartacus/styles/vendor/bootstrap/scss/tooltip';\n\n` +
`// ORDER IMPORTANT: Spartacus styles last\n` +
`@import '@spartacus/styles/index';\n`;

if (options?.theme) {
Expand Down
31 changes: 16 additions & 15 deletions projects/storefrontapp/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
@import '@spartacus/styles/scss/core';

// ORDER IMPORTANT: Bootstrap next
@import 'bootstrap/scss/reboot';
@import 'bootstrap/scss/type';
@import 'bootstrap/scss/grid';
@import 'bootstrap/scss/utilities';
@import 'bootstrap/scss/transitions';
@import 'bootstrap/scss/dropdown';
@import 'bootstrap/scss/card';
@import 'bootstrap/scss/nav';
@import 'bootstrap/scss/buttons';
@import 'bootstrap/scss/forms';
@import 'bootstrap/scss/custom-forms';
@import 'bootstrap/scss/modal';
@import 'bootstrap/scss/close';
@import 'bootstrap/scss/alert';
@import 'bootstrap/scss/tooltip';

@import '@spartacus/styles/vendor/bootstrap/scss/reboot';
@import '@spartacus/styles/vendor/bootstrap/scss/type';
@import '@spartacus/styles/vendor/bootstrap/scss/grid';
@import '@spartacus/styles/vendor/bootstrap/scss/utilities';
@import '@spartacus/styles/vendor/bootstrap/scss/transitions';
@import '@spartacus/styles/vendor/bootstrap/scss/dropdown';
@import '@spartacus/styles/vendor/bootstrap/scss/card';
@import '@spartacus/styles/vendor/bootstrap/scss/nav';
@import '@spartacus/styles/vendor/bootstrap/scss/buttons';
@import '@spartacus/styles/vendor/bootstrap/scss/forms';
@import '@spartacus/styles/vendor/bootstrap/scss/custom-forms';
@import '@spartacus/styles/vendor/bootstrap/scss/modal';
@import '@spartacus/styles/vendor/bootstrap/scss/close';
@import '@spartacus/styles/vendor/bootstrap/scss/alert';
@import '@spartacus/styles/vendor/bootstrap/scss/tooltip';

// ORDER IMPORTANT: Spartacus styles last
@import '@spartacus/styles';
2 changes: 1 addition & 1 deletion projects/storefrontstyles/scss/cxbase/_functions.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'bootstrap/scss/functions';
@import '@spartacus/styles/vendor/bootstrap/scss/functions';
@import 'functions/spacer';
@import 'functions/merge';
2 changes: 1 addition & 1 deletion projects/storefrontstyles/scss/cxbase/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// we load variables through the theme import. */
@import '../theme';

@import 'bootstrap/scss/_mixins';
@import '@spartacus/styles/vendor/bootstrap/scss/_mixins';

@import './mixins/reset';
@import './mixins/weight';
Expand Down
2 changes: 1 addition & 1 deletion projects/storefrontstyles/scss/cxbase/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// The Sparta buttons use uppercase type but future themes may want normal case
// so a variable was created to make this available for other themes.
@import 'functions';
@import 'bootstrap/scss/variables';
@import '@spartacus/styles/vendor/bootstrap/scss/variables';

$background: $white !default;
$inverse: $white !default;
Expand Down

0 comments on commit 7e87602

Please sign in to comment.