-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Clarify how the docs / Playground deployment process works #616
Comments
You're right, playground now relies on the latest npm package which is extracted/served by jsdelivr. To test it locally, you'll need to copy the JS from I'm working on the next npm package release in which I want #618 be included and test coverate to 100% again. Please expect this week.
This depends on |
Thanks! I've opened #619 to contribute instructions on how to build the Playground site and point it to the local build of LiquidJS. Regarding Ace, I didn't know it, so I took a skim through their documentation on syntax highlighting: They call syntax highlighters "modes" and show how to add and extend them.
function createEditor(id, lang) {
const editor = ace.edit(id);
editor.setTheme('ace/theme/tomorrow_night');
editor.getSession().setMode('ace/mode/' + lang);
editor.getSession().setOptions({
tabSize: 2,
useSoftTabs: true
});
editor.renderer.setScrollMargin(15);
return editor;
} This is then called elsewhere in the same file to initialize the three Playground editors: const editor = createEditor('editorEl', 'liquid');
const dataEditor = createEditor('dataEl', 'json');
const preview = createEditor('previewEl', 'html'); Here we can see we set the The syntax highlighting rules specifically are found here: I tried figuring out how to adjust these files to make the filters I added highlight, but it is confusing to me how the rules even work. I decided to ask a discussion question in the Ace project: @harttle if you happen to know the answer please let me know, in the meanwhile I will monitor the Ace project discussion question I created and will try to figure out how to add support for the new filter names in to the Liquid code highlighter. |
Actually, I just tried pasting the code with the new filter name to the Ace kitchen sink demo page here: https://ace.c9.io/build/kitchen-sink.html. When I select Liquid as the mode there, both old and new filter names get highlighted the same way there. I figured maybe the theme had some effect on things so I removed this line: This switched the Ace instance in the Playground to the default theme, same as the one on the Ace Kitchen Sink site. Even in this case, the Can you think of why the discrepancy? Playground without theme ( Ace Kitchen Sink (both filter names are highlighted): The difference is subtle, but you can see on the Ace site both names are highlighted but on the LiquidJS Playground site, only one is. Here is the test code I am using in case you want to try to reproduce the issue: {% assign people = "alice, bob, carol" | split: ", " -%}
{% assign people = people | push: "tom" %}
<ul>
{%- for person in people %}
<li>
<a href="{{person | prepend: "http://example.com/"}}">
{{ person | capitalize }}
</a>
</li>
{%- endfor%}
</ul> |
🎉 This issue has been resolved in version 10.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@TomasHubelbauer I believe the latest ace version addresses that issue. Just updated to latest and it works on my local server. |
That's awesome, thank you! I can confirm it works perfectly now for me as well: I noticed that in the live Playground it doesn't work yet and it still reports the version as 10.7.1. Do you see the same?
I checked and this returns the 10.7.1 source. If we use this URL it returns 10.8.0:
This is the same as (at the time of writing):
Do you know why without I am wondering though it maybe it just takes JSDelivr a while to switch the first URL to the latest version, not sure… |
I guess so.
I agree, it’d be better. Maybe there’ll a subtle performance regression but I think it’s perfectly OK. |
I am trying to learn how to test my changes in the Playground when running locally. For this I am working through the build process to understand how all the pieces go together to make the Playground build and serve and use the built Liquid version.
I think the process of building the Playground is rather simple:
npm run build:docs
callsbuild-docs.sh
and it goes todocs
and runsnpm ci
followed bynpm run build
npm run build
indocs
just callshexo generate
and that's how we getpublic/playground.html
andpublic/js/main.js
playground.html
is just compiledplayground.pug
index.js
is copied over fromthemes/navy/source/js/main.js
The the docs site can be run locally by running
npm start
indocs
.At this point I know how the HTML of the site is built and I know the JS controlling the stuff like reacting to the changes in the editor and running the source code there through Liquid.
But as far as I can see,
main.js
just touches theliquidjs
global.And the only way I can see that referenced is in the HTML like so:
This is from
docs/themes/navy/layout/partial/after_footer.swig
.Does this mean the local version of the site still uses LiquidJS from NPM and not the local build in
dist
?https://www.npmjs.com/package/liquidjs
I am trying to figure out because even though I contributed #611 and the Docs GitHub Actions workflow ran successfully, the live site of the Playground doesn't seem to work any differently,
push
there still doesn't work. I see the last release on NPM is from a month ago, so it wouldn't contain my changes I made and explain the situation.If I understood everything correctly, it means you might need to cut a new NPM release in order for #611 and #612 to work on the live Playground site, right? Could you please do that?
And do you have any tips or tricks for using the local build of LiquidJS in the Playground? One of the things I am wondering about is whether once the new NPM version is released and the live site is made to use it, whether it will correctly highlight the
push
filter name like it does for other filters. If there is work that needs to be done to support that, I will be happy to do it, but I need to make sure so far I've understood everything correctly.The text was updated successfully, but these errors were encountered: