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.

140 lines
6.1 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. ---
  2. layout : 'default'
  3. css : 'guide'
  4. title : 'Local Docs'
  5. description : 'A guide to generating docs locally'
  6. type : 'Semantic Project'
  7. ---
  8. <script src="/javascript/intro.js"></script>
  9. <%- @partial('header') %>
  10. <div class="main container">
  11. <div class="peek">
  12. <div class="ui vertical pointing secondary menu">
  13. <a class="active item">Install Steps</a>
  14. <a class="item">Using Grunt</a>
  15. </div>
  16. </div>
  17. <h2 class="ui dividing header">Step by Step</h2>
  18. <p>It may be useful to run the development docs locally when working on a forked version of semantic, as the docs themselves help in testing out changes to ui components.</p>
  19. <h3 class="ui header">1. Install Node</h3>
  20. <p>Semantic docs are written in DocPad which requires NodeJS. </p>
  21. <div class="ui warning message">Make sure npm does not require sudo to operate, this might cause permissions issues.</div>
  22. <p>There are many tutorials online on how to install node in your environment, here are a few we think are helpful:</p>
  23. <ul class="ui list">
  24. <li><a href="https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager">Node JS via Package Manager</a></li>
  25. <li><a href="https://gist.github.com/isaacs/579814">Installing Node JS without sudo</a></li>
  26. </ul>
  27. <h3 class="ui header">2. Fork Semantic</h3>
  28. <iframe src="http://ghbtns.com/github-btn.html?user=semantic-org&repo=semantic=ui&type=fork&count=true&size=large"
  29. allowtransparency="true" frameborder="0" scrolling="0" width="90" height="30"></iframe>
  30. <p>Fork the Semantic repo into a directory on your local machine and navigate into that directory</p>
  31. <p>Alternatively, you can <a href="https://github.com/Semantic-Org/Semantic-UI/archive/master.zip">download the entire repository as a zip</a> instead of using Git</p>
  32. <h3 class="ui header">3. Install Dependencies</h3>
  33. <p>NPM (Node Package Manager) keeps track of all the dependencies required for the project.</p>
  34. <p>Updating npm inside the local directory will grab all development dependencies from <code>package.json</code> and store them in the root of the project.</p>
  35. <div class="code" data-title="Installing dependencies" data-type="terminal">
  36. npm update; npm install;
  37. </div>
  38. <h3 class="ui header">4a Creating Packages for Server</h3>
  39. <p>Additionally your server needs to have the latest version of Semantic built before the documentation will appear formatted correctly. Running <code>grunt build</code> will create a version of the library at <code>docs/build</code> available for your server</p>
  40. <div class="code" data-title="Updating semantic for docs" data-type="terminal">
  41. grunt build
  42. </div>
  43. <h3 class="ui header">4b Watching Files</h3>
  44. <p>Docpad will automatically generate a static (html/css only) version of the documentation everytime you update a file inside <code>server/</code></p>
  45. <p>If you would like it to build semantic everytime you edit a file inside <code>src/</code> you will have to run the grunt watch script.</p>
  46. <div class="code" data-title="Installing dependencies" data-type="terminal">
  47. grunt watch;
  48. </div>
  49. <h3 class="ui header">4c. Start Your Server</h3>
  50. <p>Now that you've installed all the dependencies, starting your server should be a simple command</p>
  51. <div class="code" data-title="Starting server locally" data-type="terminal">
  52. docpad run
  53. </div>
  54. <p>Docpad should now run the documentation on a local server accessible at <code>http://localhost:9778</code></p>
  55. <p>A static version of the documentation will be generated every time you make a change to a document. This will also be available in the <code>docs/</code> folder.
  56. <h3 class="ui header">5. (Optional) Install Karma</h3>
  57. <p>
  58. Unit tests are written in Jasmine, but are run using a test runner called Karma. To install karma you need to grab the npm package.
  59. </p>
  60. <div class="code" data-title="Installing Test Runner" data-type="terminal">
  61. npm install -g karma
  62. </div>
  63. <p>Installing Karma will allow you to run the unit tests on Javascript to ensure all tests are passed when changes are made to javascript code. This will also occur automatically when you create a pull request</p>
  64. <h2 class="ui dividing header">Using Grunt</h2>
  65. <h3 class="ui header">Watch Changes in Source</h3>
  66. <p>If you are working on fixing a UI component that is part of Semantic, your best bet is to work actively on the file in <code>/src/{type}/{elementname}/</code> while running a watch script from grunt. This will rebuild the docs after you make changes, so you can see if you have corrected the issue you are fixing.</p>
  67. <p>To see exactly what this grunt tasks is doing view our <a href="https://github.com/semantic-org/Semantic-UI/blob/master/Gruntfile.js">commented gruntfile</a></p>
  68. <div class="code" data-title="Watching Changes" data-type="terminal">
  69. grunt
  70. </div>
  71. <p>The watch task is the default grunt task for Semantic, so you can start it quite simply. This will copy files automatically from the <code>src</code> directory, compiling LESS files, whenever any changes are made.</p>
  72. <h3 class="ui header">Run Unit Tests</h3>
  73. <p>Tests will automatically run with <code>grunt watch</code> if you have started karma</p>
  74. <div class="code" data-title="Execute tests while developing" data-type="terminal">
  75. karma start
  76. grunt watch
  77. </div>
  78. <p>You can also run the test suite manually</p>
  79. <div class="code" data-title="Execute tests while developing" data-type="terminal">
  80. npm test
  81. // or
  82. grunt test
  83. // or
  84. karma run
  85. </div>
  86. <h3 class="ui header">Build Semantic Packages Locally</h3>
  87. <p>There is also a separate grunt command for building minified, packaged, and compressed versions of the library. This might be useful when creating custom builds of Semantic.</p>
  88. <div class="code" data-title="Building Release Files" data-type="terminal">
  89. grunt build
  90. </div>
  91. <h3 class="ui header"></h3>
  92. <div class="ui divider"></div>
  93. <a class="ui large right labeled teal icon button" href="/introduction.html">
  94. Next: Library Introduction
  95. <i class="right arrow icon"></i>
  96. </a>
  97. </div>