CodeIgniter Forums
CI4 RC3 - How to access css file in vendor directory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forum-10.html)
+--- Thread: CI4 RC3 - How to access css file in vendor directory (/thread-74837.html)



CI4 RC3 - How to access css file in vendor directory - elyday - 11-13-2019

Hello,

I started building views for my CI4 project today. This directly encounters my first problem:
I installed Bootstrap via Composer and wanted to access its css file in my view, which didn't work (which makes sense in itself).

Is it possible to access the vendor folder and its CSS files from the view or do I always have to copy the CSS files into public/ folders?


Best regards
elyday


RE: CI4 RC3 - How to access css file in vendor directory - dave friend - 11-13-2019

Using Composer to install Bootstrap is usually done when you want to customize and or extend BootStrap. In short, it means using tools like Sass, Less, Grunt, Gulp, Webpack, etc to transform and package assets for the browser. Eventually, some of those tools typically put their output in a public folder for consumption.

In other words, copy the files from vendor to your assets folders.

Bear in mind that code in vendor might expect assets to be in vendor somewhere. It's been too long since I worked with Bootstrap so I don't know if that's a real concern.


RE: CI4 RC3 - How to access css file in vendor directory - elyday - 11-14-2019

(11-13-2019, 06:54 PM)daveĀ friend Wrote: Using Composer to install Bootstrap is usually done when you want to customize and or extend BootStrap. In short, it means using tools like Sass, Less, Grunt, Gulp, Webpack, etc to transform and package assets for the browser. Eventually, some of those tools typically put their output in a public folder for consumption.

In other words, copy the files from vendor to your assets folders.

Bear in mind that code in vendor might expect assets to be in vendor somewhere. It's been too long since I worked with Bootstrap so I don't know if that's a real concern.

Hm... ok, too bad. By using Composer at this point I would have the possibility of easier and more central updating of dependencies.

Thank you anyway Smile


RE: CI4 RC3 - How to access css file in vendor directory - loopzzz - 11-15-2019

basic idea is to glue together all css or js dependencies in a single css / js file and copy that to public directory

WEBPACK module bundler or any other compressor tool can do this but you have to use node or other cli tools to do this ...
and the bundler will generate final files to the public/ folder

this can be automated to run on each change of your style.css or script files, and will generate latest bundle all the time which is done with file watcher tools