![]() |
Recommended path for npm - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Recommended path for npm (/showthread.php?tid=77028) |
Recommended path for npm - aswinkumar863 - 07-13-2020 What is the recommended path/folder for npm, that is root or public? In laravel framework, npm can be installed in the root and accessed by laravel mix. How can I do it here? Thank you. RE: Recommended path for npm - jreklund - 07-13-2020 CodeIgniter dosen't have that kind of library, so you need to put your JS files in the public folder, for it to be accessible. RE: Recommended path for npm - captain-sensible - 07-15-2020 @aswinkumar863 are you talking in terms of installing add-ons via npm such as : npm install bootstrap RE: Recommended path for npm - aswinkumar863 - 07-15-2020 (07-15-2020, 01:47 AM)captain-sensible Wrote: @aswinkumar863 are you talking in terms of installing add-ons via npm such as : Yes RE: Recommended path for npm - captain-sensible - 07-19-2020 ok I will give you the quickish, around the houses answer where i give you an example of installing gulp using npm. I just used npm to install gulp into a new development directory called "appstarter" yes i have no imagination but it keeps the reduces the amount of decisions. I'm on Linux (slackware - of course :^) ) So i did a change directory to (the root of the directory ) /var/www/htdocs/appstarter I did re-use previous package.json i will put it here for perusal . Code: { SO all i had to do was run : Code: npm install which was done from the root of the appstarter dir I put a gulpfile.js also at the root ; so i simply take that into consideration with converting scss into css. Couple of things though; i'm a bit old school have known and previously used composer and begining to see the benefits when things need up dating. So you see "bootstrap": "^4.5.0" in the package.json , well i decided to use composer for the sass version of bootstrap which is : Code: composer require twbs/bootstrap Also for me on Linux i needed to install nodejs I first as root ran : [CODE] # npm install --global gulp-cli [/CODE} RE: Recommended path for npm - aswinkumar863 - 07-21-2020 (07-19-2020, 12:35 PM)captain-sensible Wrote: ok I will give you the quickish, around the houses answer where i give you an example of installing gulp using npm. If I am not wrong, you are using gulp to bundle the assets in the root directory and outputs it in public directory. So that you can access it. Seems Legit. RE: Recommended path for npm - captain-sensible - 07-22-2020 yes i install whats necessary so that when i am using command line and have cd'd into root of dev, running: Code: gulp task For the last dev project i used composer; so the relative path from my dev root to bootstrap scss is : Code: vendor/twbs/bootstrap/scss/ and o in mygulpfile.js i quote as the source for scss : Code: .src('vendor/twbs/bootstrap/scss/*.scss ')/ Code: .pipe(gulp.dest('public/css')) the result is that bootstrap sccs and custom sccss is converted to css and is put where i want it in public at /public/css what i also do is use gitignore so that scss stuff is ignored. when i uploaded to live server i zipped needed directories which were only : CI4 ├── PHPMailer.zip ├── app.zip ├── public.zip ├── vendor.zip └── writable.zip I switched to using composer for bootstrap and also for CI4 to make it easier to update. I couldn't find anything pure and straight forward at https://packagist.org/ that i understood for gulp thats why i still use npm for that |