set-up-project.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <title>Set up a UI Project :: jMonkeyEngine Docs</title>
  7. <link rel="canonical" href="https://wiki.jmonkeyengine.org/wiki-ui/set-up-project.html">
  8. <link rel="prev" href="prerequisites.html">
  9. <link rel="next" href="build-preview-ui.html">
  10. <meta name="generator" content="Antora 3.0.1">
  11. <link rel="stylesheet" href="../_/css/site.css">
  12. <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
  13. <meta property="og:description" content="Set up a UI Project">
  14. <meta property="og:title" content="jMonkeyEngine Docs">
  15. <link rel="stylesheet" href="../_/css/site-extra.css">
  16. <link rel="stylesheet" href="../_/css/vendor/docsearch.min.css">
  17. <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->
  18. <link rel="icon" href="../_/img/favicon.ico" type="image/x-icon">
  19. </head>
  20. <body class="article">
  21. <header class="header">
  22. <nav class="navbar">
  23. <div class="navbar-brand">
  24. <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
  25. <img alt="" src="../_/img/jme-logo.png" height="32" type="image/x-icon">
  26. </a>
  27. <div class="navbar-item hide-for-print">
  28. <input id="search-input" type="text" placeholder="Search docs">
  29. </div>
  30. <button class="navbar-burger" data-target="topbar-nav">
  31. <span></span>
  32. <span></span>
  33. <span></span>
  34. </button>
  35. </div>
  36. <div id="topbar-nav" class="navbar-menu">
  37. <div class="navbar-end">
  38. <div class="navbar-item theme-switch-wrapper">
  39. <label class="theme-switch" for="checkbox">
  40. <input type="checkbox" id="checkbox" />
  41. <div class="slider round"></div>
  42. </label>
  43. </div>
  44. <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
  45. </div>
  46. </div>
  47. </nav>
  48. </header>
  49. <div class="body">
  50. <div class="nav-container" data-component="wiki-ui" data-version="master">
  51. <aside class="nav">
  52. <div class="panels">
  53. <div class="nav-panel-menu is-active" data-panel="menu">
  54. <nav class="nav-menu">
  55. <h3 class="title"><a href="index.html">Wiki UI</a></h3>
  56. <ul class="nav-list">
  57. <li class="nav-item" data-depth="0">
  58. <ul class="nav-list">
  59. <li class="nav-item" data-depth="1">
  60. <a class="nav-link" href="prerequisites.html">UI Development Prerequisites</a>
  61. </li>
  62. <li class="nav-item is-current-page" data-depth="1">
  63. <a class="nav-link" href="set-up-project.html">Set up a UI Project</a>
  64. </li>
  65. <li class="nav-item" data-depth="1">
  66. <a class="nav-link" href="build-preview-ui.html">Build and Preview the UI</a>
  67. </li>
  68. <li class="nav-item" data-depth="1">
  69. <a class="nav-link" href="development-workflow.html">UI Development Workflow</a>
  70. </li>
  71. <li class="nav-item" data-depth="1">
  72. <a class="nav-link" href="templates.html">Work with the Handlebars Templates</a>
  73. </li>
  74. <li class="nav-item" data-depth="1">
  75. <button class="nav-item-toggle"></button>
  76. <a class="nav-link" href="stylesheets.html">Work with the CSS Stylesheets</a>
  77. <ul class="nav-list">
  78. <li class="nav-item" data-depth="2">
  79. <a class="nav-link" href="add-fonts.html">Add Fonts</a>
  80. </li>
  81. </ul>
  82. </li>
  83. <li class="nav-item" data-depth="1">
  84. <button class="nav-item-toggle"></button>
  85. <a class="nav-link" href="style-guide.html">UI Element Styles</a>
  86. <ul class="nav-list">
  87. <li class="nav-item" data-depth="2">
  88. <a class="nav-link" href="inline-text-styles.html">Inline Text</a>
  89. </li>
  90. <li class="nav-item" data-depth="2">
  91. <a class="nav-link" href="admonition-styles.html">Admonitions</a>
  92. </li>
  93. <li class="nav-item" data-depth="2">
  94. <a class="nav-link" href="list-styles.html">Lists</a>
  95. </li>
  96. <li class="nav-item" data-depth="2">
  97. <a class="nav-link" href="sidebar-styles.html">Sidebars</a>
  98. </li>
  99. <li class="nav-item" data-depth="2">
  100. <a class="nav-link" href="ui-macro-styles.html">UI Macros</a>
  101. </li>
  102. </ul>
  103. </li>
  104. </ul>
  105. </li>
  106. </ul>
  107. </nav>
  108. </div>
  109. <div class="nav-panel-explore" data-panel="explore">
  110. <div class="context">
  111. <span class="title">Wiki UI</span>
  112. <span class="version">master</span>
  113. </div>
  114. <ul class="components">
  115. <li class="component">
  116. <span class="title">JME</span>
  117. <ul class="versions">
  118. <li class="version">
  119. <a href="../docs/3.8/documentation.html">3.8</a>
  120. </li>
  121. <li class="version">
  122. <a href="../docs/3.4/documentation.html">3.4</a>
  123. </li>
  124. <li class="version">
  125. <a href="../docs/3.3/documentation.html">3.3</a>
  126. </li>
  127. <li class="version">
  128. <a href="../docs/3.2/documentation.html">3.2</a>
  129. </li>
  130. </ul>
  131. </li>
  132. <li class="component">
  133. <span class="title">Wiki Contribution</span>
  134. <ul class="versions">
  135. <li class="version">
  136. <a href="../docs-wiki/3.8/wiki_contributor.html">3.8</a>
  137. </li>
  138. </ul>
  139. </li>
  140. <li class="component is-current">
  141. <span class="title">Wiki UI</span>
  142. <ul class="versions">
  143. <li class="version is-current">
  144. <a href="index.html">master</a>
  145. </li>
  146. </ul>
  147. </li>
  148. </ul>
  149. </div>
  150. </div>
  151. </aside>
  152. </div>
  153. <main class="article">
  154. <div class="toolbar" role="navigation">
  155. <button class="nav-toggle"></button>
  156. <nav class="breadcrumbs" aria-label="breadcrumbs">
  157. <ul>
  158. <li><a href="index.html">Wiki UI</a></li>
  159. <li><a href="set-up-project.html">Set up a UI Project</a></li>
  160. </ul>
  161. </nav>
  162. <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki-ui/edit/master/docs/modules/ROOT/pages/set-up-project.adoc">Edit this Page</a></div>
  163. </div>
  164. <div class="content">
  165. <article class="doc">
  166. <h1 class="page">Set up a UI Project</h1>
  167. <div id="preamble">
  168. <div class="sectionbody">
  169. <div class="paragraph">
  170. <p>Before you can start working on the UI, you need to grab the sources and initialize the project.
  171. The sources can be <a href="https://gitlab.com/antora/antora-ui-default.git">Antora&#8217;s default UI</a> or an existing UI project structured to work with Antora.</p>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="sect1">
  176. <h2 id="fetch-the-default-ui-project"><a class="anchor" href="#fetch-the-default-ui-project"></a>Fetch the Default UI project</h2>
  177. <div class="sectionbody">
  178. <div class="paragraph">
  179. <p>To start, clone the default UI project using git:</p>
  180. </div>
  181. <div class="literalblock">
  182. <div class="content">
  183. <pre>$ git clone https://gitlab.com/antora/antora-ui-default.git &amp;&amp;
  184. cd "`basename $_`"</pre>
  185. </div>
  186. </div>
  187. <div class="paragraph">
  188. <p>The example above clones Antora&#8217;s default UI project and then switches to the project folder on your filesystem.
  189. Stay in this project folder in order to initialize the project using npm.</p>
  190. </div>
  191. </div>
  192. </div>
  193. <div class="sect1">
  194. <h2 id="install-dependencies"><a class="anchor" href="#install-dependencies"></a>Install dependencies</h2>
  195. <div class="sectionbody">
  196. <div class="paragraph">
  197. <p>Next, you&#8217;ll need to initialize the project.
  198. Initializing the project essentially means downloading and installing the dependencies into the project.
  199. That&#8217;s the job of npm.</p>
  200. </div>
  201. <div class="paragraph">
  202. <p>In your terminal, execute the following command (while inside the project folder):</p>
  203. </div>
  204. <div class="literalblock">
  205. <div class="content">
  206. <pre>$ npm install</pre>
  207. </div>
  208. </div>
  209. <div class="paragraph">
  210. <p>This command installs the dependencies listed in <em class="path">package.json</em> into the <em class="path">node_modules/</em> folder inside the project.
  211. This folder does not get included in the UI bundle.
  212. The folder is safe to delete, though npm does a great job of managing it.</p>
  213. </div>
  214. <div class="paragraph">
  215. <p>You&#8217;ll notice another file which seems to be relevant here, <em class="path">package-lock.json</em>.
  216. npm uses this file to determine which concrete version of a dependency to use, since versions in <em class="path">package.json</em> are typically just a range.
  217. The information in this file makes the build reproducible across different machines and runs.</p>
  218. </div>
  219. <div class="paragraph">
  220. <p>If a new dependency must be resolved that isn&#8217;t yet listed in <em class="path">package-lock.json</em>, npm will update this file with the new information when you run <code>npm install</code>.
  221. Therefore, you&#8217;re advised to commit the <em class="path">package-lock.json</em> file into the repository whenever it changes.</p>
  222. </div>
  223. </div>
  224. </div>
  225. <div class="sect1">
  226. <h2 id="supported-build-tasks"><a class="anchor" href="#supported-build-tasks"></a>Supported build tasks</h2>
  227. <div class="sectionbody">
  228. <div class="paragraph">
  229. <p>Now that the dependencies are installed, you should be able to run the <code>gulp</code> command to find out what tasks the build supports:</p>
  230. </div>
  231. <div class="literalblock">
  232. <div class="content">
  233. <pre>$ gulp --tasks-simple</pre>
  234. </div>
  235. </div>
  236. <div class="paragraph">
  237. <p>You should see:</p>
  238. </div>
  239. <div class="literalblock output">
  240. <div class="content">
  241. <pre>default
  242. clean
  243. lint
  244. format
  245. build
  246. bundle
  247. bundle:pack
  248. preview
  249. preview:build</pre>
  250. </div>
  251. </div>
  252. <div class="paragraph">
  253. <p>We&#8217;ll explain what each of these tasks are for and when to use them.</p>
  254. </div>
  255. </div>
  256. </div>
  257. <nav class="pagination">
  258. <span class="prev"><a href="prerequisites.html">UI Development Prerequisites</a></span>
  259. <span class="next"><a href="build-preview-ui.html">Build and Preview the UI</a></span>
  260. </nav>
  261. </article>
  262. <aside class="toc sidebar" data-title="Contents" data-levels="2">
  263. <div class="toc-menu"></div>
  264. </aside>
  265. </div>
  266. </main>
  267. </div>
  268. <footer class="footer">
  269. <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
  270. </footer>
  271. <script src="../_/js/vendor/docsearch.min.js"></script>
  272. <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
  273. <script>
  274. var search = docsearch({
  275. apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
  276. indexName: 'jmonkeyengine',
  277. inputSelector: '#search-input',
  278. autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
  279. algoliaOptions: { hitsPerPage: 10 }
  280. }).autocomplete
  281. search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
  282. function focusSearchInput () { document.querySelector('#search-input').focus() }
  283. if (document.querySelector('.home-link.is-current')) window.addEventListener('load', focusSearchInput)
  284. </script>
  285. <script src="../_/js/site.js"></script>
  286. <script async src="../_/js/vendor/highlight.js"></script>
  287. </body>
  288. </html>