Skip to content
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

Major refactor of pipeline system to support next wave of features. #73

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

thedodd
Copy link
Member

@thedodd thedodd commented Oct 6, 2020

All assets which are to be processed by trunk must now be declared as
HTML link elements as such:
<link data-trunk rel="rust|sass|..." data-attr0 data-attr1/>.
The links may appear anywhere in the HTML and Trunk will process them and
replace them or delete them based on the associated pipeline's output.
If the link element does not have the data-trunk attribute, it will not
be processed.

The --manifest-path flag has been removed in favor of the new link
style: <link data-trunk rel="rust" href="path/to/Cargo.toml"/>. This is optional,
and will default to the Cargo.toml of the source HTML's parent dir if
not specified.

Update README describing new asset pipeline declaration pattern.

closes #50
closes #72

todo

  • ensure HTML pipelines replace their source HTML element. If declared in the head, then it should be replaced there, if declared in the body then it should be replaced there.
  • update README describing new functionality.
  • update README to clarify that when data-trunk links are processed, their HTML will be replaced based on where they exist in the DOM. So if links need to appear in the HTML body for including the WASM/JS, adding the data-trunk link to the HTML body will solve that problem.
  • update docs for rust-worker asset type. The href attr should behave exactly as it does for the rust asset type.

for anyone willing to review

Please take a look at the rendered README file. The main thing which needs review/feedback here is the pattern which I've landed on for declaring assets (which is mostly discussed in the assets section of the README).

@thedodd thedodd self-assigned this Oct 6, 2020
@thedodd thedodd force-pushed the hacking-on-0.7.0 branch 2 times, most recently from 683f910 to 7701795 Compare October 6, 2020 04:43
@thedodd thedodd changed the title Hacking on 0.7.0 Major refactor of pipeline system to support next wave of features. Oct 6, 2020
@thedodd thedodd force-pushed the hacking-on-0.7.0 branch 4 times, most recently from 910bdaf to 833f214 Compare October 6, 2020 22:20
@thedodd
Copy link
Member Author

thedodd commented Oct 6, 2020

@siku2 && @MartinKavik I'm very interested to see what you both think about where this has landed. This will make adding new asset types sane, predictable and easily extensible.

The main thing which I think you both might be interested in is the rendered README file. The main thing which needs review/feedback here is the pattern which I've landed on for declaring assets (which is mostly discussed in the assets section of the README).

The TL;DR, especially as it relates to the web worker discussion which we had going over in #46, here is how we will accomplish this using the new pattern (which everything has been updated to use this pattern now):

<head>
    <link
        data-trunk
        rel="rust-worker"
        href="path/to/Cargo.toml"
        data-bin="web-worker"
        data-arg0="0"
        data-arg1="1"
    />
</head>

A standard HTML link, data-trunk to inform Trunk that it should process this element as a pipeline, rel="rust-worker" to indicate the asset/pipeline type, href is the path to the manifest (or the parent dir of the manifest), and then any other options we want to support, we can add them here.

@thedodd
Copy link
Member Author

thedodd commented Oct 7, 2020

For anyone interested/watching, I am currently using a release build of this PR for development on a private app. I'll be merging this into master soon.

All assets which are to be processed by trunk must now be declared as
HTML `link` elements as such:
`<link data-trunk rel="rust|sass|..." data-attr0 data-attr1/>`.
The links may appear anywhere in the HTML and Trunk will process them and
replace them or delete them based on the associated pipeline's output.
If the link element does not have the `data-trunk` attribute, it will not
be processed.

The `--manifest-path` flag has been removed in favor of the new link
style: `<link rel="rust" href="path/to/Cargo.toml"/>`. This is optional,
and will default to the Cargo.toml of the source HTML's parent dir if
not specified.

Update README describing new asset pipeline declaration pattern.

closes #50
@thedodd thedodd merged commit 476dff2 into master Oct 8, 2020
@thedodd thedodd deleted the hacking-on-0.7.0 branch October 8, 2020 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Init script location in index.html Ensure rel="trunk-dist" will copy over directories
1 participant