So Webpack is for bundling stuff. It has a lot of use case it seems, but I'm new to it so I might be missing something or using it incorrectly.
Currently it's probably mostly used for bundling JS and CSS and perhaps handling images with the file-loader or url-loader.
It also seems to bundle and do its plugin stuff in a cascading way. Meaning that a import in import will get evaluated and so I see that a image which is stored in a CSS file thusly:
background-image: url(../images/banner.jpg);
will go through the loader that handles .jpg files and gets moved through to the dist folder as well as the CSS will have the relevant path updated according to this. I'm not sure what part of webpack manages that, is it the css-loader perhaps that ensures this?
The problem arises since I'm currently developing a WP theme which uses PHP templates. This I never pass through the Webpack pipeline. PHP loader seems to be about converting to HTML and that is no good.
So if I have a <img src="images/brand.jpg"> tag in the template I would have to manually import that image, and ensure that I have the right path to a currently non-existing bundle. I can also forget about inlining images using url-loader or svg-loader for example.
Is this just a ( currently ) non-existing use case for Webpack since most users are doing React or Vue projects with it.
Or am I missing something obvious?
If you still seek for an answer for that question - you can achieve that with Webpack manifest plugin (and [optionally] with Webpack copy plugin) and some php handler to parse the manifest.
I have a working version which you can see here
https://github.com/LowGravityPL/RaccoonWP/tree/master/public/core/themes/raccoon-twig
Webpack code is in build-utils directory
Good day,
I have a third-party library that I would like to use with cake 2.x. Is consists of many .php files located in different nested folders. I would like to know if there is a way to import all the files with one single command e.g. make the import go through all the folders and include all the files located in them.
Thank You in advance.
I think what you are looking for is composer. It's a dependency manager for php. It lets you include (and update very easily) external library into your project, and has an autoloader.
for example, here is my path to one of my library:
application/libraries/samples/samples.php
now how would i load the samples.php library in codeigniter, since it is not at the root level of the libraries folder? basically can i do this:
$this->load->library("samples");
will that load the samples library even tho its not in the root of the libraries folder?
Sorry im new to codeigniter, and the codeigniter docs do not say about multiple directories in the libraries folder. But i don't see why they would miss that out, seems reasonable to include that info or support it.
Just put the path to the library in your request:
$this->load->library("samples/samples");
I am new to CI. I am using version 2. I noticed like other frameworks CI didn't have folders like assets and layout. Where do i place files like css and js and images. Also where is the layout folder.
You can place your assets directory wherever you desire, putting it under the root CodeIgniter directory is usually the norm.
CodeIgniter has no reason to include an assets directory as that's usually a front-end requirement, of which CI isn't made for (it's a back end MVC framework).
a simple answer is no. CI don't have that. You need to manually create.
And if you are coming from Yii, Ci doesn't implement that feature of Layout.
EDIT
by default, CI doesn't have. You can tweak it but easier implementation is
$this->load->view('header', $param1);
$this->load->view('content', $param2);
$this->load->view('footer', $param3);
where param1, param2, .... are variables you want to pass it to view.
CI will add the views in that order.
and remember, don't put .php while at the end of the filename in view().
No
Is the simple answer, you have to extend CIs functionality and use a library from a third party to provide these features for you. CI doesn't focus on the aesthetics of the "front-end". Its primary focus was "back-end".
Your Options:
look into Phil Sturgeons template library, and CI Sprinkles library first is for layout/theme/partials management, second is for asset management js/css minification and caching.
Phil's Template Library: http://philsturgeon.co.uk/demos/codeigniter-template/user_guide/
Sprinkles Library: https://github.com/edmundask/Sprinkle
Or build your own basic template library
This is a great intro video how to do such. I have used this in the past, before i got into using Sparks.
http://www.youtube.com/watch?v=gvGymDhY49E
you can use Sparks to make lib management a bit easier
In 2.1 sparks aren't included however it is in the dev builds of CI so im sure at a later date it will be merged in with the base code. FOr now you can use this site to install Sparks to help you manage third party libraries.
http://getsparks.org
You don't have to use a template library.
You don't have to programmatically serve the CSS and JS it can just be part of a view file.
But, you can if you want to! CI is incredibly flexible. We've written our own template library that works great for us (we'll release it soon, just checking that it works how we want it to...) but it might not suit the way you work.
Try using this PHP layout manager library, can be integrated with codeigniter easily:
https://github.com/mahadazad/php-layout-manager
its easy to setup and use.
look for assets helper to load css and js file anywhere..
Simple assets helper for codeigniter
I want to integrate KCFinder inside Zend framework, i want this
http://kcfinder.sunhater.com/demo/kcfinder/browse.php?type=files&dir=files/public
page to be included inside my template without using any iframe, i had tried many things by calling browser.php file inside my view but i am facing issues with file loading and their dependencies, even resolving php file dependency by using autoloader js files are not loading properly
Please help me out on this
I had collaborated with project like CKfinder called Elrte.org
and i did make a custom ZF form element for it
a sample example on my github account :
https://github.com/tawfekov/Elrte-Element-for-Zend-Framework
the demo has ability to show the rich text editor + file manager
feel free to extend it or to get an example of it