This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How ICMS 2.0 should manage front-end assets? #134
Comments
Initially I was thinking about the fxp/composer-asset-plugin but I am not sure anymore that that is the best option. There are also packages in composer itself for most of the high-profile javascript libraries, but they aren’t well integrated if you include them that way.
A good question to which I don’t really have an answer. Any idea how other CMSes do this?
Van: Raimondas Rimkevičius
Verzonden: maandag 29 januari 2018 13:36
Aan: ImpressCMS/impresscms
CC: Subscribed
Onderwerp: [ImpressCMS/impresscms] How ICMS 2.0 should manage front-end assets?(#134)
We have composer for all PHP libraries, but what about front-end libraries like jquery? What we should use?
From what I know, we have right now two main options with few suboptions:
1. Use composer for that:
a) fxp/composer-asset-plugin - most popular variant, however it needs to be installed globally on the server
b) beelab/bowerphp - doesn't need global install, but doesn't work with all assets and also only bower, which looses popularity
c) foxy/foxy - acts more like proxy between composer and npm
2. Use native like many standalone networks does. I think this is most elegant way however I'm not sure how to make possibility to add it easy into modules. And another problem - not every shared hosting has preinstalled such tool.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
My short research: all popular cms'es just puts assets into folder and that's it. No specitific assets handling. But I'm not sure if this is a good way.
For building operations we would need server with shell access. I'm not sure if we such have right now. If no, I don't think so that will cost much but if I'm wrong (that means that such service would be on big demand) we could maybe start offer paid services for everyone who doesn't like to wait much more. |
I more or less came to the same conclusion. Most CMSes have conventions where to store the libraries, but that library pool isn’t really managed. When it is managed, you can have cases where the managed version of a library is out of date, but no new managed version of a library is available (Drupal with the jQuery component in D7 for example).
I think we’ll leave the non-PHP libraries as-is, detailing what folder they should be, but not restricting that more. At least not in the first couple of versions of Icms 2.x
I find your idea for the service intriguing, but I think that the complexity of all the different libraries that are handled all differently, coul be overwhelming.
|
Most JS libraries could be resolved with WebPack. Also, it lets include different assets versions in same website without conflicts. Laravel Mix is easy way to walk into WebPack world. So, maybe we could move our JS core libs to webpack with some legacy bindings and for module authors just ask them to use webpack for prebuild their assets and then load their builds (they will need to include prebuilded JS files in their views)? Later we could implement a bit better way for doing such things. |
I kinda like the idea of working with webpack. Let’s investigate some options there and see if we can get a first working solution in the next few days.
|
I think we should postphone this one question. I know how to implement this but this needs some free time. Maybe at the first we need move as much from core to composer libs as we can - later it would be easier to make some improvements to core |
I think easiest solution for us at least for now would be to use kriswallsmith/assetic. It's impossible with it download assets but it's possible to include front-end assets and compile, minify if is needed from any path. So, I think it would be good enough for us for a while. |
It seems DYFeng/composer-asset-plugin that tries to fix many issues that fxp/composer-asset-plugin has, so probably this could be a good tool for us to download module and main front-end assets. |
DYFeng/composer-asset-plugin seems doesn't work yet. Xoops has assets manager. It works. But it is not usable outside their CMS. It has good ideas but not so good implementation. So, that's why I think best way it would be a create composer lib and include it in our CMS. How I think this lib should work:
|
Based on ziadoz/awesome-php#742 it seems that kriswallsmith/assetic probably will not be updated ever. So, it's not a good choice for us :/ |
nodejs-installer composer plugin that installs npm in vendor folder. So, NodeJS doesn't need to be installed on the server to be able to use it for assets. One possible problem here - what to do if |
asset-packagist.org is another way how we could include assets for modules/cms. It's a repository that lets download many popular front-end assets with composer without any plugins. Looks good, but problem with it is that we everything goes to vendor and with #159 vendor is no more a public folder. Another problem is that it doesn't provides ant tools how to work with ES modules and these things now use many front-end developers. |
After some investigation I think I have figure out how assets management for ICMS should work. imponeer/composer-yarn-installer downloads and installs yarn if is not available on system. foxy/foxy fetches package.json from modules and updates local node modules installation. Than another not yet available composer plugin would find modules with encore.config.js. This plugin will merge all these JS files and starts Symfony Encore that builds JS modules. These modules will be able to be included on website. Of course if anyone would like to use old style script inclusion, they could use if they want. Probably > 90% old style scripts would work. Too not run always
|
The issue I have here is that you need a web host that needs command-line access, and it makes things much more complicated. In my view, the front-end developer has the responsibility to make the build, and then push the finalised product to the CMS. There are too many frontend build pipelines (Ruby, node.js, rust, bower, gulp, ...) around, and we shouldn't limit the options for frontend development (theming, javascript framework integration), because things change so fast in that domain, that it will be impossible to stay up to date. |
Maybe pipelines are too much for us right now, but I would like at least add more secure assets instaltion model. Right now including in module folder as works now exposes also other files that shouldn't be accessible. |
This issue was automatically marked as stale |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
We have composer for all PHP libraries, but what about front-end libraries like jquery? What we should use?
From what I know, we have right now two main options with few suboptions:
a) fxp/composer-asset-plugin - most popular variant, however it needs to be installed globally on the server
b) beelab/bowerphp - doesn't need global install, but doesn't work with all assets and also only bower, which looses popularity
c) foxy/foxy - acts more like proxy between composer and npm
The text was updated successfully, but these errors were encountered: