简体   繁体   中英

Apostrophecms - What is the difference between js files added in different places

Apostrophecms - What is the difference between client side js files added in different places

  1. The file which I will add in my-module -> public -> js -> always.js

  2. The file which I will add in my-module -> src -> always.js

Thanks in advance!

Apostrophe 2.x (the current major release) has no src folders at all, so I'm not sure where that part of the question might come from.

But files in my-module/public/js can be pushed via pushAsset calls in the module, and if this is done by the module or any of its parent classes then all of the copies of always.js that exist, ie in the parent class modules or in your module, will be pushed to the browser — in order. And this is helpful for achieving your own overriding and subclassing effects in browser side code.

If you are by some chance looking at the 3.0 branch, that is very much pre-alpha code right now and should not be used for projects. But when 3.0 matures, src will replace public for most purposes, and it will contain Apostrophe admin UI code meant to be bundled by webpack. This has no bearing on the current stable release of Apostrophe though.

It is possible that you have inherited an Apostrophe project from someone who built their own tooling to compile files in src/ to targets in public/js via gulp or webpack , but this would be project-level code or independently written Apostrophe modules and not part of Apostrophe itself or any of our current sample projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM