{"id":2051,"date":"2018-05-23T19:51:32","date_gmt":"2018-05-23T19:51:32","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=2051"},"modified":"2018-10-10T17:15:56","modified_gmt":"2018-10-10T17:15:56","slug":"installing-and-running-the-primeng-showcase-locally-under-windows","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=2051","title":{"rendered":"Installing and running the PrimeNG showcase locally under windows"},"content":{"rendered":"<h2>Update 23\/5\/2018<\/h2>\n<p>I retried this using Angular 6 and the latest primeng.<\/p>\n<p>Step 2\/ below was not needed, and I did not install\/reinstall gulp per step 3\/ (not used this time \u2013 need to check\/confirm re this)<\/p>\n<p>The wiki steps referred to below, <a href=\"https:\/\/github.com\/primefaces\/primeng\/wiki\/Building-From-Source\">here<\/a>, referred to using sass to build the css, but this command did not work for me even when I installed the node.js sass per <a href=\"https:\/\/sass-lang.com\/install\">here<\/a> -&#160; the \u2013update command came back with an error.<\/p>\n<p>I then gave up using sass to compile the sass files.<\/p>\n<p>Because of this issue I still had to fix the theming, so tried to copy the css files as below rather than compile the sass. This time the themes folder was under src\\assets\\components.<\/p>\n<p>I therefore created another skeleton app, installed primeng using \u201cnpm install primeng\u201d, and then copied the themes folder from under node_modules\\primeng\\resources&#160; to src\\assets\\components, overwriting the themes already there.<\/p>\n<p>This added the css files that were missing.<\/p>\n<p>I could then run the showcase with theming fully working, either using \u201cnpm start\u201d or \u201cng serve\u201d \u2013 either worked.<\/p>\n<p>I did notice that the theming borders on the treetable component did not appear to work, but apart from that all the theming including theme switching worked fine.<\/p>\n<h2>Original Post<\/h2>\n<p>It is useful to have this running locally in order to can try out occasional code hacks on the example code to try out ideas or check how things work if the docs are not clear on a point, knowing that you have started from a working example.<\/p>\n<p>The steps for this basically follow the wiki steps <a href=\"https:\/\/github.com\/primefaces\/primeng\/wiki\/Building-From-Source\">here<\/a>. Note the following additions\/amendments to the steps:-<\/p>\n<p>1\/ I cloned the repository from <a href=\"https:\/\/github.com\/primefaces\/primeng\">here<\/a>. Having cloned I then listed and disconnected from the remote repositories, as the clones were just for local use:-<\/p>\n<blockquote>\n<p>git remote \u2013v<\/p>\n<p>git remote rm origin<\/p>\n<p>git remote \u2013v<\/p>\n<\/blockquote>\n<p>2\/ Dependencies as follows were added to package.json as per instructions:-<\/p>\n<blockquote>\n<pre>  &quot;dependencies&quot;: {\r\n      &quot;@angular\/common&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/compiler&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/core&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/forms&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/http&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/platform-browser&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/platform-browser-dynamic&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/router&quot;: &quot;4.0.0&quot;,\r\n      &quot;@angular\/animations&quot;: &quot;4.0.0&quot;,\r\n      &quot;core-js&quot;: &quot;^2.4.1&quot;,\r\n      &quot;rxjs&quot;: &quot;^5.2.0&quot;,\r\n      &quot;zone.js&quot;: &quot;^0.8.4&quot;\r\n  },<\/pre>\n<\/blockquote>\n<p>Following this <em>npm install<\/em> was run to download all the dependencies<\/p>\n<p>3\/ In order to build using gulp as instructed (<em>gulp build<\/em>), I installed gulp first as per the instructions <a href=\"https:\/\/github.com\/gulpjs\/gulp\/blob\/master\/docs\/getting-started.md\">here<\/a>:-<\/p>\n<blockquote>\n<pre>npm install --global gulp-cli<\/pre>\n<pre>npm install --save-dev gulp<\/pre>\n<\/blockquote>\n<p>4\/ I then ran <em>npm start<\/em> to run the showcase, which defaults to <a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a><\/p>\n<p>The showcase ran ok locally but there were some issues with the theming \u2013 the theme had a transluscent background on the menus and dropdowns for example which did not correctly occlude the text underneath. The live showcase on the PrimeNG site did not have this problem. <\/p>\n<p>On investigation it appears that the theme files are under the main resources\/themes directory, but are not being sass compiled from scss during the build so there are no .css files there. The gulp file for the project, <em>gulpfile.js<\/em>, does not have any entries that do sass compilation so this may be an omission\/bug in the version I had downloaded.<\/p>\n<p>The showcase does not use the <em>primeng<\/em> under node_modules \u2013 it defines its own <em>primeng<\/em> package such that if you try to enter <em>npm install primeng <\/em>to install the themes in the normal way as part of the npm installed package, you get an error from npm about the duplicate <em>primeng<\/em>.<\/p>\n<p>My workaround was straightforward \u2013 I just copied the theme folder and all subfolders from under the <em>node_modules\\primeng\\resources<\/em> directory in another application folder to the projects top level resources directory (in fact I used the <em>primeng-quickstart-webpack<\/em> which I had already set up) \u2013 any other project where you have installed <em>primeng<\/em> will do. This solved the problem by providing all the css files for the themes, and the themes and theme switching then worked.<\/p>\n<p>As I have no requirement to do a full working build for the showcase this is no problem. <\/p>\n<p><em><strong>I checked for other posts about theming issues and found a couple of StackOverflow posts about theme issues with Webpack <\/strong><\/em><a href=\"http:\/\/stackoverflow.com\/questions\/40463026\/primeng-style-not-loaded-with-webpack\"><em><strong>here<\/strong><\/em><\/a><em><strong> and <\/strong><\/em><a href=\"http:\/\/stackoverflow.com\/questions\/39960363\/primeng-stylesheets-not-found\/40464229#40464229\"><em><strong>here<\/strong><\/em><\/a><em><strong>. These may prove relevant for future development.<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 23\/5\/2018 I retried this using Angular 6 and the latest primeng. Step 2\/ below was not needed, and I did not install\/reinstall gulp per step 3\/ (not used this time \u2013 need to check\/confirm re this) The wiki steps referred to below, here, referred to using sass to build the css, but this command [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[198,209],"tags":[13,40,16,15],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2051"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2051"}],"version-history":[{"count":11,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2051\/revisions"}],"predecessor-version":[{"id":2207,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2051\/revisions\/2207"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}