Integrating Semantic UI to an Angular CLI Project
Tags: angular, webdev, css, beginners
Published: 2017-12-20 09:48:41

---
title: "Integrating Semantic UI to an Angular CLI Project"
published: true
tags: Angular,WebDev,CSS,Beginners
canonical_url: 
---

### I’m tired of Bootstrap (Ok, I still love it and use it often).

I recently discovered Semantic UI, and I’m loving it so far. For those of you who aren’t familiar with Semantic UI, it is a styling framework much like Bootstrap. The difference is Semantic’s classes use syntax from natural language like noun/modifier relationships, word order, and plurality to link concepts intuitively.

So I’m now playing around with it and including it into my latest Angular CLI projects. You can check out their documentation here: [https://semantic-ui.com](https://semantic-ui.com/introduction/getting-started.html)

There are a few ways to include it. The easiest being using the CDN or just including their CSS file. The downside to these options is you can only use their default theme. By installing Semantic UI in the following method, you get the full power of custom theming capabilities. Let’s get started.

### What you’ll need

- Node.js
- Angular CLI
- Semantic UI
- Gulp

### Installation

1. Node.js  
Head over to the Node.js site: [https://nodejs.org/](https://nodejs.org/)  
Make sure you install Node 6.9.0 or higher.  
Open up a terminal and check that your npm version is 3.0.0 or higher: `$ npm -v`.  
You can also check your node version by: `$ node -v`.

2. Angular CLI & TypeScript  
Next install TypeScript (you don’t need it, but you should use it): `$ npm install -g typescript`.  
Now install the Angular CLI with: `$ npm install -g @angular/cli`.

3. Gulp  
We need Gulp to build the final configuration of our Semantic UI theme, so let’s do a global install of Gulp:  
`$ npm install --global gulp-cli`.

4. Semantic UI  
Let’s start off with installing Semantic UI into your Angular project.  
If you are starting fresh, create a new Angular Project with the CLI: `$ ng new semanticui-angular-project`.  
`cd` into your the root of your project and install Semantic UI: `$ npm install semantic-ui`.  
You’ll be prompted a few questions, just go with the defaults and install it into a root level folder called `semantic`.  
 ![semantic-ui install](https://i1.wp.com/www.chiangs.ninja/blog/wp-content/uploads/2017/10/Screen-Shot-2017-10-10-at-07.15.48.png?resize=1170%2C165&ssl=1)

Next we need to tell the project to include the `dist` CSS and JS files. You’ll notice there isn’t a `dist` folder yet.  
You’ll need to `cd` into the `semantic` folder and run `$ gulp build`. This will take the default configuration from `semantic/src/theme.config` and build it into production files.  

You can update or customise the build in a moment.  
Next, open up your `angular_cli.json`, you’ll need to include the CSS and JS from the `dist` folder.

```
...
   "styles": [
        "../semantic/dist/semantic.min.css",
        "sass/styles.scss"
   ],
   "scripts": [
        "../semantic/dist/semantic.min.js"
   ],
...
```

At this point, you can run your project and you should see a slight difference already:  
 ![Angular Comparison](https://i2.wp.com/www.chiangs.ninja/blog/wp-content/uploads/2017/10/Screen-Shot-2017-10-10-at-08.05.13.png?resize=1170%2C432&ssl=1)

From here, you can go back to the `theme.config` file and change the build around, but I strongly suggest looking at the documentation examples first. After that, I normally create a custom theme folder in `src/themes` and copy over all the components from the various themes I want to use / override, and then update the relevant portions of the `theme.config` file to the name of the custom theme folder.

Just don’t forget to run `$ gulp build` again when you make a change!

So there you have it, have fun and please leave feedback or questions!