Skip to content

Commit

Permalink
minor #2787 Removed the bootstrap-all files (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.0.x-dev branch.

Discussion
----------

Removed the bootstrap-all files

This implements the idea suggested by @alterphp in #2784. The new docs explain it:

```
Loading the Entire Bootstrap Framework
--------------------------------------

In EasyAdmin versions prior to 2.2.1, the backend didn't load the entire CSS and
JavaScript code from Bootstrap but only the parts that used it. This was made to
improve performance and required loading some separate files called
``bootstrap-all.css`` and ``bootstrap-all.js`` when you needed to use some
Bootstrap feature not included by default.

Given that the performance gain was minimal, this idea was abandoned and,
starting from EasyAdmin 2.2.1 the entire Boostrap CSS and JavaScript code is
loaded by default in all pages.
```

On my local computer, the compressed size of the entire Bootstrap contents is reasonable: 77KB for JS and 43KB for CSS.

Commits
-------

7784d92 Removed the bootstrap-all files
  • Loading branch information
javiereguiluz committed Jul 6, 2019
2 parents 85942f7 + 7784d92 commit 8f33ad7
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 185 deletions.
35 changes: 2 additions & 33 deletions assets/css/app.scss
@@ -1,29 +1,7 @@
@import "./easyadmin-theme/variables.css";
@import "./easyadmin-theme/variables.scss";

// Imports only the Bootstrap styles used by default in the backend.
// If you develop features that need other Bootstrap components, check out the
// bootstrap-all.css file that provides the rest of the Bootstrap styles
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/mixins";
@import "~bootstrap/scss/reboot";
@import "~bootstrap/scss/type";
@import "~bootstrap/scss/grid";
@import "~bootstrap/scss/forms";
@import "~bootstrap/scss/buttons";
@import "~bootstrap/scss/button-group";
@import "~bootstrap/scss/transitions";
@import "~bootstrap/scss/dropdown";
@import "~bootstrap/scss/input-group";
@import "~bootstrap/scss/nav";
@import "~bootstrap/scss/badge";
@import "~bootstrap/scss/alert";
@import "~bootstrap/scss/close";
@import "~bootstrap/scss/modal";
@import "~bootstrap/scss/tooltip";
@import "~bootstrap/scss/popover";
@import "~bootstrap/scss/utilities";
@import "~bootstrap/scss/bootstrap";

@import "~@fortawesome/fontawesome-free/css/all.css";
@import "~@fortawesome/fontawesome-free/css/v4-shims.css";
Expand All @@ -32,13 +10,4 @@
@import "~select2/dist/css/select2.css";
@import "~select2-bootstrap-theme/dist/select2-bootstrap.css";

@import "./easyadmin-theme/base.scss";
@import "./easyadmin-theme/menu.scss";
@import "./easyadmin-theme/datagrids.scss";
@import "./easyadmin-theme/images.scss";
@import "./easyadmin-theme/forms.scss";
@import "./easyadmin-theme/buttons.scss";
@import "./easyadmin-theme/switches.scss";
@import "./easyadmin-theme/select2.scss";
@import "./easyadmin-theme/errors.scss";
@import "./easyadmin-theme/pages.scss";
@import "./easyadmin-theme/theme.scss";
25 changes: 0 additions & 25 deletions assets/css/bootstrap-all.scss

This file was deleted.

1 change: 1 addition & 0 deletions assets/css/easyadmin-theme/base.scss
Expand Up @@ -63,6 +63,7 @@ body.easyadmin-sidebar-width-compact .wrapper {
}
.main-header .navbar {
display: flex;
padding: 0;
}

.main-header #header-logo {
Expand Down
1 change: 1 addition & 0 deletions assets/css/easyadmin-theme/datagrids.scss
Expand Up @@ -9,6 +9,7 @@ table.datagrid {
background: var(--form-bg);
}
.datagrid thead th {
border: 0;
padding: 0;
}
.datagrid thead a, .datagrid thead span {
Expand Down
13 changes: 13 additions & 0 deletions assets/css/easyadmin-theme/theme.scss
@@ -0,0 +1,13 @@
@import "./easyadmin-theme/variables.css";
@import "./easyadmin-theme/variables.scss";

@import "./easyadmin-theme/base.scss";
@import "./easyadmin-theme/menu.scss";
@import "./easyadmin-theme/datagrids.scss";
@import "./easyadmin-theme/images.scss";
@import "./easyadmin-theme/forms.scss";
@import "./easyadmin-theme/buttons.scss";
@import "./easyadmin-theme/switches.scss";
@import "./easyadmin-theme/select2.scss";
@import "./easyadmin-theme/errors.scss";
@import "./easyadmin-theme/pages.scss";
2 changes: 1 addition & 1 deletion assets/css/easyadmin-theme/variables.css
Expand Up @@ -11,7 +11,7 @@

--font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-family-base: var(--font-family-sans-serif);
--font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

--font-size-base: 0.875rem; /* 14px */
--font-size-lg: 1rem; /* 16px */
Expand Down
10 changes: 1 addition & 9 deletions assets/js/app.js
Expand Up @@ -3,15 +3,7 @@ require('../css/app.scss');

global.$ = global.jQuery = require('jquery');

// Imports only the Bootstrap JS components used by default in the backend.
// If you develop features that need other Bootstrap components, check out the
// bootstrap-all.js file that provides the rest of the Bootstrap JS plugins
import 'bootstrap/js/src/modal.js';
import 'bootstrap/js/src/tab.js';
import 'bootstrap/js/src/tooltip.js';
import 'bootstrap/js/src/popover.js';
import 'bootstrap/js/src/dropdown.js';
import 'bootstrap/js/src/collapse.js';
import 'bootstrap/js/src/index.js';

import './adminlte.js';
import 'jquery.are-you-sure';
Expand Down
10 changes: 0 additions & 10 deletions assets/js/bootstrap-all.js

This file was deleted.

28 changes: 9 additions & 19 deletions doc/book/design-configuration.rst
Expand Up @@ -149,25 +149,15 @@ locale of the application is ``ar`` (Arabic), ``fa`` (Persian) or ``he``
Loading the Entire Bootstrap Framework
--------------------------------------

In order to improve performance, the backend doesn't load the entire CSS and
JavaScript code from Bootstrap but only the parts that uses it. If you create
custom backends, you may need to load the missing Bootstrap parts.

Instead of downloading and including the entire Bootstrap yourself, you can use
the ``bootstrap-all.css`` and ``bootstrap-all.js`` files provided by EasyAdmin
which contains all the Bootstrap parts not included by default by the backend:

.. code-block:: yaml
easy_admin:
# ...
design:
assets:
css:
# ...
- 'bundles/easyadmin/bootstrap-all.css'
js:
- 'bundles/easyadmin/bootstrap-all.js'
In EasyAdmin versions prior to 2.2.1, the backend didn't load the entire CSS and
JavaScript code from Bootstrap but only the parts that used it. This was made to
improve performance and required loading some separate files called
``bootstrap-all.css`` and ``bootstrap-all.js`` when you needed to use some
Bootstrap feature not included by default.

Given that the performance gain was minimal, this idea was abandoned and,
starting from EasyAdmin 2.2.1 the entire Boostrap CSS and JavaScript code is
loaded by default in all pages.

Customizing the Backend Design
------------------------------
Expand Down
9 changes: 7 additions & 2 deletions src/Resources/public/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/public/app.css.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/Resources/public/app.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/Resources/public/bootstrap-all.css

This file was deleted.

1 change: 0 additions & 1 deletion src/Resources/public/bootstrap-all.css.map

This file was deleted.

64 changes: 0 additions & 64 deletions src/Resources/public/bootstrap-all.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/Resources/public/entrypoints.json
Expand Up @@ -16,14 +16,6 @@
"./app-rtl.js"
]
},
"bootstrap-all": {
"css": [
"./bootstrap-all.css"
],
"js": [
"./bootstrap-all.js"
]
},
"form-type-code-editor": {
"css": [
"./form-type-code-editor.css"
Expand Down
3 changes: 0 additions & 3 deletions src/Resources/public/manifest.json
Expand Up @@ -3,15 +3,12 @@
"bundles/easyadmin/app.js": "./app.js",
"bundles/easyadmin/app-rtl.css": "./app-rtl.css",
"bundles/easyadmin/app-rtl.js": "./app-rtl.js",
"bundles/easyadmin/bootstrap-all.css": "./bootstrap-all.css",
"bundles/easyadmin/bootstrap-all.js": "./bootstrap-all.js",
"bundles/easyadmin/form-type-code-editor.css": "./form-type-code-editor.css",
"bundles/easyadmin/form-type-code-editor.js": "./form-type-code-editor.js",
"bundles/easyadmin/form-type-text-editor.css": "./form-type-text-editor.css",
"bundles/easyadmin/form-type-text-editor.js": "./form-type-text-editor.js",
"bundles/easyadmin/app-rtl.css.map": "./app-rtl.css.map",
"bundles/easyadmin/app.css.map": "./app.css.map",
"bundles/easyadmin/bootstrap-all.css.map": "./bootstrap-all.css.map",
"bundles/easyadmin/fonts/fa-brands-400.eot": "./fonts/fa-brands-400.8e49b728.eot",
"bundles/easyadmin/fonts/fa-brands-400.woff": "./fonts/fa-brands-400.9f018d10.woff",
"bundles/easyadmin/fonts/fa-brands-400.woff2": "./fonts/fa-brands-400.9f4ce3dc.woff2",
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Expand Up @@ -34,7 +34,6 @@ Encore

.addEntry('app', './assets/js/app.js')
.addEntry('app-rtl', './assets/js/app-rtl.js')
.addEntry('bootstrap-all', './assets/js/bootstrap-all.js')
.addEntry('form-type-code-editor', './assets/js/form-type-code-editor.js')
.addEntry('form-type-text-editor', './assets/js/form-type-text-editor.js')
;
Expand Down

0 comments on commit 8f33ad7

Please sign in to comment.