You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below are some of the steps required, defined with assistance of @aarongerig in issues and gitter chats.
It would be beneficial if they could be verified and added to the official documentation.
The following assumes you are using webpack, npm and less.
01) To install UIkit in your project, in your repo directory, run npm install --save-dev uikit.
02) Change into /node_modules/uikit and run the following:
npm install
npm install yarn
npm run compile
(edit: 09/03/24 - i had to install pnpm in order to run npm run compile successfully, ie: npm install -g pnpm)
03) Create a file at your_repo/path_to_your_source/js/uikit.js with the following contents:
// comment out the things you don't need, uncomment the things you do needimportUIkitfrom'uikit/dist/js/uikit-core';// import Countdown from 'uikit/dist/js/components/countdown';// import Filter from 'uikit/dist/js/components/filter'; importLightboxfrom'uikit/dist/js/components/lightbox';// import LightboxPanel from 'uikit/dist/js/components/lightbox-panel'; // import Notification from 'uikit/dist/js/components/notification';// import Parallax from 'uikit/dist/js/components/parallax';// import Slider from 'uikit/dist/js/components/slider'; // import SliderParallax from 'uikit/dist/js/components/slider-parallax'; // import Slideshow from 'uikit/dist/js/components/slideshow';importSortablefrom'uikit/dist/js/components/sortable';// import Tooltip from 'uikit/dist/js/components/tooltip';// import Upload from 'uikit/dist/js/components/upload';importIconsfrom'uikit/dist/js/uikit-icons';UIkit.use(Icons);// UIkit.component('countdown', Countdown);// UIkit.component('filter', Filter); UIkit.component('lightbox',Lightbox);// UIkit.component('lightboxPanel', LightboxPanel); // UIkit.component('notification', Notification);// UIkit.component('parallax', Parallax);// UIkit.component('slider', Slider); // UIkit.component('sliderParallax', SliderParallax); // UIkit.component('slideshow', Slideshow);UIkit.component('sortable',Sortable);// UIkit.component('tooltip', Tooltip);// UIkit.component('upload', Upload);exportdefaultUIkit;
04) Create the following in your_repo/path_to_your_source/css/:
-- custom_uikit_theme
--- my_theme
---- _import.less
--- my_theme.less <-- this will contain all your custom css
05) Add the following to the top of my_theme.less:
my_repo
- src
-- js
--- uikit.js <- this is the js file you created above
--- common.js <- this is where you import the js and css files created above
-- css
-- custom_uikit_theme <- this is the custom theme you created above
--- my_custom_theme.less
--- my_custom_theme
---- _import_less
---- any_components_you_are_overwriting_here
-- img
- app.js
- package.json
- webpack.config.js
Now, every time you upgrade UIkit you will just need to run your own webpack build process and the latest UIkit files will be used.
TO DO:
To include custom icons in your own your_repo/src/img/custom/icons directory so that they are available in the same manner UIkit library icons are, eg:
For those of you that are looking to include custom icons in your own your_repo/src/img/custom/icons directory, i've sort of found a way to do so through calling uikit's build/icons.js
For this to work you need to do the following:
Install all of the required dependencies to run the script: npm install --save-dev minimist fs-extra path glob less svgo rollup uglify-js clean-css rollup-plugin-html rollup-plugin-json rollup-plugin-buble rollup-plugin-replace rollup-plugin-import-alias
create your icons directory for which you want to include icons from, in my case, I am using mkdir assets/icons, and place your icons in it
Copy the node_modules/uikit/src/js/icons.js to <project root>/src/js/icons.js, this step is required as the node_modules/uikit/build/icons.js script references the src/js/icons.js script relative to the working directory instead of the module directory. Making the following change to the node_modules/uikit/src/js/icons.js script will make this work without copying the script, and from my limited testing will not break anything else:
run node node_modules/uikit/build/icons.js --custom="assets/icons" to build your icons, this will create a dist/js/uikit-icons-assets.js file at your root directory.
Use the newly created file, I use this through webpack, so I do this like so:
There are additional steps required to have a custom UIkit theme outside of
/node_modules/uikit
.It is important to do this so that customisations are not overwritten when upgrading UIkit.
These steps are not described at the following locations:
https://getuikit.com/docs/custom-icons
https://getuikit.com/docs/installation
Below are some of the steps required, defined with assistance of @aarongerig in issues and gitter chats.
It would be beneficial if they could be verified and added to the official documentation.
The following assumes you are using
webpack
,npm
andless
.01)
To install UIkit in your project, in your repo directory, runnpm install --save-dev uikit
.02)
Change into/node_modules/uikit
and run the following:(edit: 09/03/24 - i had to install
pnpm
in order to runnpm run compile
successfully, ie:npm install -g pnpm
)03)
Create a file atyour_repo/path_to_your_source/js/uikit.js
with the following contents:04)
Create the following inyour_repo/path_to_your_source/css/
:05)
Add the following to the top ofmy_theme.less
:06)
Paste the following into_import.less
:07)
For each component you do overwrite, add the relevant file to the directory:your_repo/path_to_your_source/css/custom_uikit_theme/my_theme
For example, if you were overwriting
position.less
, add a file calledposition.less
to the above directory with your contents, eg:08)
Add the following lines to yoursrc/js/common.js
file:09)
Add this to yourwebpack.config.js
file:10)
Your repo will now look something like this:Now, every time you upgrade UIkit you will just need to run your own
webpack
build process and the latest UIkit files will be used.TO DO:
To include custom icons in your own
your_repo/src/img/custom/icons
directory so that they are available in the same manner UIkit library icons are, eg:do this...
The text was updated successfully, but these errors were encountered: