Replies: 7 comments 12 replies
-
You mention the root public/ folder, but I think you're actually talking
about the module's public/ folder.
We don't currently directly serve static files from public/ of every
module. in 3.x.
However, in the 3.0 branch (not the published alpha) we currently
incorporate all .css and js files found in the ui/public subdirectory of
any activated module into separate CSS and JS bundles. These are
incorporated with no preprocessing — no SASS, no LESS, no Babel for
JavaScript, etc — because developers tend to have their own preferences for
building assets that will be used on the front end.
If you need to serve other types of files in a module you could potentially
use `apos.express.static` yourself. We haven't committed either way on
whether we'll do something like that ourselves.
…On Mon, Feb 8, 2021 at 11:53 AM Miro Yovchev ***@***.***> wrote:
Are we able to publish module css/js assets as separate files in A3 root
public/ folder as it was done in A2 and if yes how?
I have this working HTTP path with A2:
***@***.***/apos-ds-pages/css/bundle.css which was published from
location (bundle)
***@***.***/apos-ds/lib/modules/apos-ds-pages/public/css/bundle.css
.
I was going to fix the paths (removing lib/) after I see styles and
frontend js is back on the page. Could it be part of the problem?
From what I read in the alpha docs, ui/public assets (.js and .css) will
be automatically bundled. So I have 2 issues:
1. I can't see it work. There is no trace of module owned JS/CSS in
the front-end bundle, so I guess I'm doing it wrong (although reading the
asset module code everything looks OK on first glance)
2. I really need separate .js and .css files published to the public
folder due to the nature of the project I'm working on
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2716>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27IFSTCHSBO6LBXMQ7TS6AJHPANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
myovchev
-
Any JS file in that folder will get pulled directly into the main .js file
that is served to the browser, you do not need express for .css or .js
files.
This happens in the@apostrophecms/asset:build task.
…On Thu, Feb 11, 2021 at 11:17 AM Miro Yovchev ***@***.***> wrote:
This is exactly what the docs says (and exactly what I need) but I fail to
understand how it works. Are they exposed directly as express static? Is it
required the build core task to be executed in order to publish them?
Let's say we have installed @namespace/product module and inside
@namespace/product/ui/public/js/bundle.js
What would be the asset url and what exactly happens?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27NC4MOTNGBNE5B5PGTS6P7J3ANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Is this about the order of loading? Apostrophe should load them in the
order modules are activated in app.js, with the core module assets coming
before that. If not we have a bug.
…On Sat, Feb 13, 2021, 5:38 AM Miro Yovchev ***@***.***> wrote:
It's what I thought is happening. In my extremely custom case I need those
files separately published, because I need them to NOT interfere with the
Apostrophe core at all. I understand it's something which most probably no
one would ever need so I'm going to manually copy them to the public folder
via internal module build task. I might also investigate how remote asset
publish (CDN) works.
Thanks for your time!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27IF2VU444KSIKA5LFTS6ZJCZANCNFSM4XJKWT2Q>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
So you're looking for a promise event to be emitted before and after the
asset build occurs in the asset module?
…On Sun, Feb 14, 2021 at 2:23 PM Miro Yovchev ***@***.***> wrote:
No, it's about a really custom/rare requirement but the good news the
design system bundle A3 prototype is ready to kick :)
I'll publish it to github very soon (next few days) after adding some more
documentation and then I'll eagerly need your feedback.
The long story short - half of this module UI needs to be completely
separated from the user land and the apostrophe UI context. The full story
will be in the bundle docs and I'll open a dedicated discussion here.
Your current asset management looks great. Even adding my own asset
management was time of great fun :) I'd only need to discuss a tiny feature
request in this direction at some point - before/after core build hook is a
magic solution for everyone who needs more magic than you do right now
(most probably 3rd party modules). This would allow me to not force users
to execute additional asset publish task beefore/after the core asset build
one.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27LF6RJO4KBYWLURQVLS7APLJANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
5 replies
-
I am not sure I understand what you're saying about hitting the wall with
static building in A3. A3 does not invoke MongoDB during the asset build
task. Can you clarify? We know this is an issue in A2. That is not going to
change for bc reasons but we have removed it for A3.
…On Wed, Feb 24, 2021 at 9:37 AM Miro Yovchev ***@***.***> wrote:
[The source[(
https://github.com/corllete/apos-ds/blob/main/packages/apos-ds/modules/%40corllete/apos-ds-page-type/lib/tasks.js#L62).
Everything above could become a standalone script.
Basically two dependencies here, the apos.asset for the business logic to
get the releaseId and apos.attachment which connects to uploadfs and
passes the configuration of the local app using the module. It doesn't feel
right to be a script outside of the apostrophe context. Keep in mind, we
are in scenario when there is 3rd party module is being installed and
integrated. The module creator doesn't have (and don't want) to have any
control or opinion about the local app installation.
BTW I've already hit the brick with just static building - the things fail
due to mongodb dependency while I was setting up the GitHub Actions for the
project. I've never hit that in A2 due to the fact there was no building
for me outside the webpack.
IMHO your asset custom solution should become a standard routine for
plugins (tasks without fully booting apostrophe). The scenario would be
task which only needs access to module methods (business logic once, no db
queries) and options. There shouldn't be any db calls during the boot
except the standard A3 checks maybe (e.g. the initializing of empty db). I
can't see a "good" module to make requests directly on boot time within
your e.g. methods() function. Correct me if I'm wrong. However I can see
this as a hard to implement and it needs more thinking about the impact
over the core.
A simple and quick solution would be a "webhook like" one. And the most
easy one would be:
node app @apostrophe/asset:build \
--hook=/relative/to/root/path/to/script.js \
--hook=/another/one.js \
--hook=/support/shell/script.sh
It's not perfect, it's semi-automatic (still needs the user to manually
add hooks to the npm command) but it's a solid start. Maybe :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27NUHGKNTOG7MCK2CRDTAUFLNANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
1 reply
-
OK, right. So the question is what your code gains from being in an
apostrophe module and not just being a separate program that is invoked by,
let's say, "npm run build" along with the core asset build.
…On Mon, Mar 1, 2021 at 10:40 AM Miro Yovchev ***@***.***> wrote:
My custom build task did it, core build is doing great without DB access.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27OED3QDWMEFAT2IXYDTBOYQHANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
3 replies
-
Thanks to you as well!
…On Thu, Mar 4, 2021 at 10:20 AM Miro Yovchev ***@***.***> wrote:
Not frustrated at all, we are all friends around :)
I'll take the blame of not explaining the problem(s) correctly and it's
mainly due to the lack of time and concentration at this moment. I have a
solution which is good enough. Let's take our time, bring A3 to the desired
place and when the time is right I can start a different discussion with
clear and simple description of my idea about the 3rd party modules
assets/asset tasks.
And thanks for your time Tom :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2716 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27KPW5BIF3JPURZKSZ3TB6QKFANCNFSM4XJKWT2Q>
.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Are we able to publish module css/js assets as separate files in A3 root
public/
folder as it was done in A2 and if yes how?I have this working HTTP path with A2:
/modules/@corllete/apos-ds-pages/css/bundle.css
which was published from location (bundle)node_modules/@corllete/apos-ds/lib/modules/apos-ds-pages/public/css/bundle.css
.I was going to fix the paths (removing
lib/
) after I see styles and frontend js is back on the page. Could it be part of the problem?From what I read in the alpha docs, ui/public assets (.js and .css) will be automatically bundled. So I have 2 issues:
Beta Was this translation helpful? Give feedback.
All reactions