Integrating composer with codeigniter to autoload CSS and JS - codeigniter

I have composer set up in CodeIgniter 3, it is fully set up and I have installed bootstrap and font-awesome in the vendor folder. How do these then get included in my view files?
AutoLoad.php exists and I have set composer_autoload to true in config.
I was expecting bootstrap and font awesome to be automatically loaded in my HTML head. Is this correct?

Related

Can't get CKeditor to work with laravel i guess i need to use asset() but i'm not sure how

i downloaded the ckeditor package with composer but when i add <script src="/vendor/ckeditor/ckeditor/ckeditor.js"></script> in blade template it says 404 he can't find it but it exists

Laravel 5.6. A small part of blade file not updated in cache

I have a blade view file in my project.
The HTML structure is something like :
<div class="a">
<div class="b">
</div>
<div class="c">
</div>
<div>
The problem is that whenever I update anything inside class c, the changes are not rendered.
I have cleared configuration cache as well as view cache as :
php artisan config:clear && php artisan config:cache
php artisan view:clear && php artisan view:cache
This doesn't help either.
Upon further inspection, I found out that, the cache file in /project_root/storage/framework/views is separately kept for a specific part of the page only, in my case the div with class c.
I have no idea how it ended up keeping a separate cache for a small segment of a page. Can anybody suggest me a solution.
EDIT : I have tried deleting the entire cache folder /project_root/storage/framework/views as well in vain.
Other relevant informations :
Hosted server : Nginx on ubuntu
The sendfile option in nginx.conf is ON. If this is relevant.
Some ideas:
clear browser cache
check permissions to storage directory (it should be 777)
be sure that your css is compiled (if you use webpack, laravel mix or gulp or something else)
check if your css is loaded with your changes
change css file name (read about notation main.css?3.4.1 - each time when you make change in css or js it changes value after "?")
After change:
<link rel="stylesheet" href="style.css?v=3.4.2">
And:
<?php $cssVersion = "3.4.2"; ?>
<link rel="stylesheet" href="global.css?v=<?php echo $cssVersion; ?>">
If you use PHP Storm:
open menu File → Settings
go to Deployment → Options section
then uncheck option Preserve files timestamps
Good luck!

Laravel 5.7 and ExtJS 5 app configuration

I am trying for the first time to create an application with Laravel 5.7 and ExtJS 5.
There is a lot of information for Laravel / Vue and Laravel / Angular applications, but for Laravel / ExtJS it is practically non-existent (unfortunately).
I created an ExtJS app called extjs_app with cmd that I put in the public folder of the Laravel project.
In the Laravel views folder I created a view named index_extjs.blade.php containing the index.html code of the ExtJS app with the following change:
<script id="microloader" type="text/javascript" src="bootstrap.js"></script>
replaced for
<script id="microloader" type="text/javascript" src="extjs_app/bootstrap.js"></script>
And in the bootstrap.js file (I probably should not edit this file):
Ext.manifest = Ext.manifest || "bootstrap.json";
replaced for
Ext.manifest = Ext.manifest || "extjs_app / bootstrap.json"
And in the app.json file
indexHtmlPath": "index.html"
replaced for
"indexHtmlPath": "../../../resources/views/index_extjs.php"
However, despite several attempts, the files required for the ExtJS application are not loaded.
How to properly configure Laravel and ExtJS to work together?
You need to set the root route for the entire application to be served with your blade view, in your case index_extjs.blade.php.
Why? Because when anyone opens up your site, you are loading up that page and hence, loading extjs too. After that page is loaded, you can handle page changes through extjs.
So to achieve this, you need to declare your root route to server this index file:
Route::get('/', function() {
return view('index_extjs');
});
Also you need to revert all extjs config changes back to default, because everything will be relative to your extjs app inside public folder and not relative to the project itself. I hope this makes sense

How to minify html with laravel mix

I use laravel 5.6 in my project.
For example: I need minify index.php with laravel mix.
I used to work with Laravel-Elixir.
How to minify HTML with laravel mix ?
https://github.com/mercuryseries/laravel-elixir-minify-html
This package allows you to minify your static HTML files or the HTML that gets generated by your Blade template files.
Enjoy !

Laravel 5 - Loading Public JS / CSS / HTML Files From Custom Folder?

Laravel serves client side (HTML, CSS, JS) files from the /public folder by default. I am currently transitioning a Blade based front-end to an Angular based one. As a result, I am mixing Blade templating with Angular templating. I am using Blade layouts to generate a navbar, footer, and other common views while I transition the body content of my pages to Angular.
I have a folder constructed just for storing Angular files. My current app structure looks something like this:
-MyApplication
-angular
-app
-bin
-bootstrap
-config
-database
....
Is there anyway for Laravel to load my assets - stored in the /angular folder? I want to keep all my Angular files in one place, in standard Angular structure, as opposed to spreading them out and placing them in the /public Laravel folder.
You can try to create a symbolic link inside the public directory to your intended angular directory. Open your terminal and create a symbolic link like so:
ln -sfv ~/path/to/MyApplication/angular ~/path/to/MyApplication/public/angular
Don't forget to update the ~/path/to/MyApplication to your actual Laravel directory. Now you may refer to the javascript file inside the angular directory like this on your blade template:
<script src="{{ asset('angular/app.js') }}"></script>
Hope this help!

Resources