Welcome Guest, Not a member yet? Register   Sign In
CI4 RC3 - How to access css file in vendor directory
#1

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
Reply
#2

(This post was last modified: 11-13-2019, 06:55 PM by dave friend.)

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.
Reply
#3

(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
Reply
#4

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB