Comments (8)
Hmm, that certainly sounds like a bug introduced in the rewrite, I'll take a look...
from perseus.
I've just tried this with the following code, which generates a file test.txt
in the root of the project and then creates a static alias to it:
actions
.settings_actions
.add_static_aliases
.register_plugin("test-plugin", |_, _| {
let mut map = std::collections::HashMap::new();
map.insert("/test".to_string(), "test.txt".to_string());
Ok(map)
});
#[cfg(engine)]
actions
.export_actions
.before_export
.register_plugin("test-plugin", |_, _| {
std::fs::write("test.txt", "Hello, world!").unwrap();
Ok(())
});
This seems to work fine for me, as it does when I change the path so the file is placed in dist/static
(although you really shouldn't put things in there, since a user's pages could trivially override them and leave your app in a very strange state, I would strongly recommend putting them in the root of dist/
, or, better, in a directory inside dist/
named according to your plugin's name).
What exactly is your problematic code, and what is the precise error you're receiving?
from perseus.
I haven't had time to properly investigate yet, I just got an issue from a user of perseus-tailwind
and it didn't seem related to my code since normal builds work fine and I am hooking into before_export
with the same code from build.
The code is here:
https://github.com/wingertge/perseus-tailwind/blob/master/src/lib.rs
I wait for the tailwind compiler process to exit before returning from the plugin so it should be done writing.
The output path is user defined by the way, I have no control over that. I just picked dist/static/tailwind.css
as an example output path.
from perseus.
Hmm, is this on the latest beta?
from perseus.
I got around to doing more testing and it seems this is some weird behaviour from Command
actually. output()
should wait until the process has exited, but it only prints the pre-compile message so it's clearly returning before the actual compilation is run. Closing this and investigating what could be going on.
from perseus.
After further debugging, there was an error in my code but there also still seems to be an issue with perseus itself. I fixed my issue and I'm explicitly printing out whether the file exists after I run the compile step (it does), but it still says it's not there. This is just a hunch, but this feels like a path resolution issue, where regular build and export use different resolutions.
from perseus.
Ok I fixed it but this is definitely a bug. If the static alias points to /static/tailwind.css
it fails, if it points to just /tailwind.css
it succeeds. Something is breaking static aliases which host things at /static
. The location of the file doesn't actually change anything, it's the server path that breaks it.
from perseus.
This is actually a much bigger issue: any nested static aliases will fail with exporting, because the directories needed for them are not created by the CLI core!
from perseus.
Related Issues (20)
- Using the translation feature as well as having global build state causes an error when the user navigates directly to the root page (or any valid page) when not including the locale in the path. HOT 1
- Failed to run `cargo install perseus-cli` without the `--locked` flag HOT 4
- Using the builder pattern `input().bind_value(...)` perseus panics HOT 5
- Using global state in a Capsule as well as a Template leads to unreachable code being reached at build-time HOT 2
- Vectors do not work in `ReactiveState` HOT 4
- [Router] [Bug] When using `.incremental_generation()`, you cannot navigate to a new route on the same page. HOT 3
- When trying to run a perseus app with docker, it gets: `Error: asset './dist/render_conf.json' not found in store` HOT 2
- Fail proceed 'perseus build' after upgraded to v0.4.1 HOT 3
- Build-time state can be user or "segment" specific, and it's actually easy to setup HOT 3
- Missing </body></html> HOT 1
- perseus-cli/0.4.2 crate is missing the tests folder HOT 3
- console_error_panic_hook HOT 2
- State amalgamation with different types HOT 1
- The command `Perseus serve -w` is very slow when listening to a large number of files. HOT 1
- Bootstrap scrollspy support HOT 4
- Cli will report "Couldn't find cargo" when it can't find powershell HOT 12
- Unable to Fetch Data from API Container Using Sockets in Perseus Container HOT 1
- Connection refused on custom dflt_server on GET and POST HOT 4
- Ability to derive traits on reactive version of state HOT 1
- How to prevent the cli to redownload the crates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from perseus.