You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
4.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. ## Getting Semantic UI
  2. For links to download Semantic UI, check our our [download page](http://www.learnsemantic.com/guide/download.html).
  3. ## Setting Up
  4. ### Dependencies
  5. Semantic uses command-line tools to build your project while theming. After getting Semantic, you will need to install [nodejs](http://nodejs.org/download/) and [gulp](https://github.com/gulpjs/gulp/) to run the build process.
  6. Once you're up and running. Navigate to the semantic directory and install the npm dependencies
  7. ```bash
  8. # install dependencies
  9. npm install
  10. # start install script
  11. gulp
  12. ```
  13. ### Installing Semantic
  14. The first time you run gulp you will be greeted with an interactive installer
  15. ```bash
  16. # install
  17. gulp
  18. ```
  19. The installer will let you select which components to include, and specify paths for your project.
  20. | Installation Type | Description |
  21. | ------------- | ------------- |
  22. | Automatic | Installation will use the default paths, outputing css files to `dist/` and packaging all components together |
  23. | Express | Will let you move your site folder and your dist folder and select from a list of components to include in your concatenated release. |
  24. | Custom | Will prompt you for all available options |
  25. The install process will create two files: `semantic.json` stores paths for your build and sits on the top-level of your project, `theme.config` is a **LESS** file that exists in **src/** and allows you to centrally set the themes for each UI component.
  26. The installer will also create a special folder which contains your site-specific themes. The default location for this is `src/site`. For more information on using site themes, see the theming guide below.
  27. ### Manual Install
  28. If you prefer these files and folders can be moved manually instead of using the installer.
  29. ```bash
  30. mv semantic.json.example semantic.json
  31. mv src/theme.config.example src/theme.config
  32. mv src/_site src/site
  33. vi semantic.json
  34. ```
  35. ### Upgrading Semantic
  36. You can use normal package manager functions to update your project, just be sure to re-install semantic after upgrading. Re-install will **extend your `semantic.json` but not overwrite it**
  37. ```bash
  38. bower update
  39. cd ./bower_modules/semantic-ui
  40. gulp install
  41. ```
  42. > For a full list of settings for **semantic.json**, check the <a href="https://github.com/Semantic-Org/Semantic-UI/blob/1.0/tasks/defaults.js">defaults values</a> which it inherits from.
  43. ## Using Semantic Build Tools
  44. ### Gulp commands
  45. After setting up your project you have access to several commands for building your css and javascript.
  46. ```bash
  47. gulp # runs default task (watch)
  48. gulp watch # watches files for changes
  49. gulp build # builds all files from source
  50. gulp install # re-runs install
  51. ```
  52. Semantic creates minified, and uncompressed files in your source for both individual components, and the components specified for your packaged version.
  53. Keep in mind semantic will automatically adjust URLs in CSS and add vendor-prefixes as part of the build process. This means **definitions and theme files do not need vendor prefixes**.
  54. #### Advanced Usage
  55. > In addition to the paths set in `semantic.json`, you can serve files to a second location, for example, a docs instance by using a separate config file `tasks/admin/docs.json`. Using a copy of the SUI documentation may work well internally for creating a style guide to hack on the theme designs for your project.
  56. ```bash
  57. gulp serve-docs
  58. gulp build-docs
  59. ```
  60. ### Workflow
  61. Building and watching Semantic is only necessary while adjusting your UI. This is usually the first part of building a new project, and a separate process than building-out pages in your site.
  62. During this architecting phase you can try <a href="http://www.learnsemantic.com/themes/creating.html">downloading different themes</a>, adjusting your <a href="http://www.learnsemantic.com/developing/customizing.html#setting-global-variables">site-wide settings</a> (font-family, colors, etc) and tweaking components in your site's <a href="http://www.learnsemantic.com/developing/customizing.html#designing-for-the-long-now">component overrides</a>.
  63. Files in the `examples/` folder of your project can be useful for testing out changes in your UI. For example, you might run `gulp watch` download a new theme to `src/site/themes/` then adjust your `theme.config` file with the name of the new theme and refresh `examples/kitchensink.html` to inspect changes in the theme.
  64. You will only need to use Semantic's build tools while refining your UI, while designing pages you can rely on the packages in `dist/` and your software stack's normal build set-up.
  65. `gulp watch` will automatically recompile only the necessary definition files when you update `semantic.config` or any `.variables` or `.overrides` file.