This doesn’t have much impact on resulting JS size, but it will
hopefully make merge conflicts much less frequent.
The CSS growth is a little higher (6.5% increase in size) but is not
material.
If this materially reduces the number of merge conflicts we have, by
letting the git merge tools resolve some dist file mergers, I think it
would be worth it.
Some example changes in file size:
bundle.js 290K -> 301K
vendor.js 1,325K -> 1,321K
bundle.css 628K -> 669K
* Rename bundles (prep for webpack optimisation)
This might or might not reduce the overall repo size,
because git can combine similar chunks in the newly generated files
* Optimise webpack build time
Consolidates bundles, since a separation of bundle-framework.js vs. bundle-legacy.js
vs. bundle-lib.js no longer makes sense - they're all loaded upfront anyway,
since we'll be introducing more react-powered logic alongside the "legacy" JavaScript.
By consolidating into fewer bundles, we give the optimisation scripts (UglifyJS)
more options to reduce the overall file size.
The main motivation for a vendor.js is to shorten rebuild times:
Most active development is happening in files required through bundle.js.
This commit drastically reduces the rebuild time for those changes (15s to 4s).
* Panel/tab-panel and alerts spacing, button padding consistency and alignment
* Reports panel spacing adjustments
* ReportAdmin panel and toolbar spacing
* Comment change
* Fix formatting help toggle link
* Use standard line-heights and padding for buttons
* Add base panel styles
* Update to .panel styles and .toolbar spacing
* Remove legacy styles, linting fixes
* Toolbar--content to have consistent styles throughout
* Add panel and toolbar styles to areas missing them
* Replace values with variables
* Layout overrides for tabs and panels with padding
* Adjust JQueryUI button spacing to match other UI buttons
* Remove custom ReportAdmin styles
Update values to variables and modify panel and tab-panel spacing
* Remove text color override
* Remove double (.m-t-1) spacing from campaign panel
* Profile page remove legacy JLayout
* Remove legacy spacing
* Removed Layout from page so !important not needed
* Improve use of variables
* Add missing closing bracket, minor linting fixes
* Linting fixes
* Remove css importants
* Add temp fix for file upload within gridfield
Tidy structure of css
* css build
* Spacing bug fixed for campaign list alert
* Added Created field to File/Image editor
* switch default input value to null
Fix react errors and added a field description
* API Use new DBField::getSchemaValue()
We've removed the ability to directly reference JS and CSS files
for form fields and other SilverStripe features in favour of a common bundle built by Webpack.
The logical next step is to make the framework module free of frontend dependencies,
which should simplify its operation, and avoid another time intensive "npm install" on a module.
Used in iframe, so can't be rolled into other code.
Moved in admin/ since that's easier for now with Webpack entry points,
and we'll move all JS/CSS into admin/ anyway soon.
There's not a lot of benefit in packaging these separately in terms of initial CMS load size,
so let's simplify the setup. They'll eventually become lazy loaded chunks in a React-based setup
Many of these are now inline via Webpack's url-loader plugin (https://github.com/webpack/url-loader),
and a tonne were legacy references (e.g. leftovers from ComplexTableField).
Some of these might still be used in other modules like userforms,
but we're removing support for "hotlinking" images in core - they're not an API.
Responsibility for finding and referencing images and fonts is now
given to webpack. All the url references are now relative to the
component scss file, and point to font & images files in src/, rather
than assuming someone else will place them in dist.
This makes the source more modular, and makes it easier to, for
example, inline images are data URIs, or create a new build script that
builds several modules for a project in a single pass.
Workaround for bad font path in bundle.css:
ExtactTextPlugin didn’t work as well with a subfolder reference in the
filename. This is just a short-term fix and could probably be improved
to put bundle.css back in the styles subfolder.
Webpack handles images & fonts:
Responsibility for finding and referencing images and fonts is now
given to webpack. All the url references are now relative to the
component scss file, and point to font & images files in src/, rather
than assuming someone else will place them in dist.
This makes the source more modular, and makes it easier to, for
example, inline images are data URIs, or create a new build script that
builds several modules for a project in a single pass.
Clarify docs on spriting and webfonts:
We've decided to remove sprity since it comes with hundreds of dependencies,
and needs compilation within the "npm install" - dragging out the already overweight
install process, and making the resulting node_modules/ folder less portable between systems.
The bundle is generated by running “webpack” directly - gulp is no
longer needed as an intermediary. The resulting config is a lot shorter,
although more configuration is pushed into lib.js.
Modules are shared between javascript files as global variables.
Although this global state pollution is a bit messy, I don’t think it’s
practically any worse than the previous state, and it highlights the
heavy coupling between the different packages we have in place.
Reducing the width of the coupling between the core javascript and
add-on modules would probably be a better way of dealing with this than
replacing global variables with some other kind of global state.
The web pack execution seems roughly twice as fast - if I clear out my
framework/client/dist/js folder, it takes 13.3s to rebuild. However,
it’s not rebuilding other files inside dist, only the bundle files.
CSS files are now included from javascript and incorporated into
bundle.css by the webpack. Although the style-loader is helpful in some
dev workflows (it allows live reload), it introduces a flash of
unstyled content which makes it inappropriate for production.
Instead ExtractTextPlugin is used to write all the aggregated CSS
into a single bundle.css file. A style-loader-based configuration could
be introduced for dev environments, if we make use of the webpack live
reloader in the future.
Note that the following features have been removed as they don't appear to be
necessary when using Webpack:
- UMD module generation
- thirdparty dist file copying
LeftAndMain.js deps: Without it, ssui.core.js gets loaded too late,
which leads e.g. to buttons being initialised without this added behaviour.
* Remove interference of nested for__fieldgroup-item
* Adjust position of dropdown field
* Remove divider lines, adjust position of upload area
Clean up styles a bit too
* Adjust position of image
* Mostly css tidy up, added use of a few variables
* Toggle arrow was showing other icon because of icon height
* All buttons in toolbars remove margin below, adjust button link color
* Reorder sort and filter, add toolbar styles
* Add button styles to toolbar
* Remove some of the linting issues
* Added new panel variables
* Simplify variable
* Replace panel variable, insert media dialog positioning
* Update with new variable name, reduce space below toolbar
* Build
* Uploading file spacing, toolbar styles added
* Visual uploads, error upload fixes, edit details panel spacing
* Add toolbar to upload modal
* build
* Build
* increase width of pagination on gridfield
* Add height to uploading items only
* Build
* Added class back for beat test to pass
This caught us out recently where code did a strict type check for `myVar === undefined`.
The var was defined as `let myVar;`, without a value - so the check returned false (it's `null`).
To avoid this situation, we've decided to enforce declarations with values.
Note that preference should be given to single, immutable assignments via const where possible.
See http://eslint.org/docs/rules/init-declarations
Allows actions to make decisions based on the form payload.
For example, a "delete" button can pass the currently edited record ID to its API endpoint.
Form element styles should be consistent throughout the CMS.
While we still have the ability to create dropdowns (<select>) which aren't based on
Entwine/HTML rather than new components like <SingleSelectField>,
we need to ensure those are rendered the same.
By default, the Entwine-based CMS sections will transform <select>
into a ChosenJS control, but you can still apply .no-chosen.
Hence there's a need for correct height both in React and Entwine sections,
not just in a React component.
Standardise template locations
Move CMSSettingsController class to SiteConfig module
Fix CMSMenu behaviour for namespaced admin sections
Split classes into one per file
Manual fixes and cleanup