The steps below for the Default Package (with build tools). If you want to use Classic Package (without build tools), go to this Classic Package installation section. If you want to use Angular, go to this Angular Installation section.
-
Download the latest theme source from the marketplace.
-
Download and install Node.js from nodejs.org/en/download/
-
Start command prompt window or terminal and change directory to
[root]/theme/default/tools/
cd [root]/theme/default/tools
-
Npm is the package manager for JavaScript and the world’s largest software registry. If you’ve just downloaded Node.js (and therefore npm), you’ll probably need to update your npm.
npm install --global npm@latest
Verify that npm in successfully installed, and version of installed npm will appear.
npm --version
-
Yarn is a package manager for your code.
npm install --global yarn
Verify that yarn in successfully installed, and version of installed yarn will appear.
yarn --version
Here is just a way to install yarn, using npm package manager. Alternatively, you can install yarn using other methods as stated in yarn installation site. More information on yarn installation, check the documentation: https://yarnpkg.com/lang/en/docs/install/
Don't forget to run
yarn upgrade
after every Metronic updates released in order to install newly added or updated 3rd-party plugins. -
Gulp is a toolkit that helps you automate your time-consuming tasks in development workflow. To install gulp globally.
npm install --global gulp-cli
If you have previously installed a version of
gulp
globally, remove it to make sure old version doesn't collide with newgulp-cli
.npm rm --global gulp
Verify that gulp in successfully installed, and version of installed gulp will appear.
gulp --version
-
Install yarn dependencies. Must execute in
[root]/theme/default/tools/
folder.yarn
-
This below command will compile all the assets(sass, js, media) and copy HTML templates to
[root]/theme/default/dist/
folder.gulp build
By default
dist
folder does not exist and it will be generated only after running gulp task. -
This is an optional gulp task for demo purpose. It does set all the demo backend URL to point to demo API(
KTDatatable
andDatatables.net
server side data fetching demos) in server.gulp apiurl
For more information about the
Build Tools
, click here. -
Start the localhost server.
gulp localhost
Keep the console open. Open this link to run
http://localhost:8080/default/
-
The customization should be done from
[root]/theme/default/src/assets/
. After compilation refer to the distination folder[root]/theme/default/dist/
. -
Watch the edited assets files (sass and js source files)
gulp watch
Watcher tracks changes to the files and automatically runs the compiler.
-
Watch the edited sass files
gulp watch:scss
Run the watcher for the SASS files only.
-
Watch the edited js files
gulp watch:js
Run the watcher for the JS files only.
For more information about the Build Tools
, click here.