GithubHelp home page GithubHelp logo

Comments (8)

KermanX avatar KermanX commented on May 31, 2024 1

Thank you for pointing this out. I know what the problem is now. Currently, the user root is the closest folder to cwd
with a package.json, which may be not the best solution...

I think there are 3 possible resolving modes.

  • Closest package root to cwd (Current)
    Pros: If slides are managed in a monorepo, this way gives users the maximum flexibility.
    Cons: This forces users to use monorepo (with a monorepo tool like PNPM) if there are multi slides in one package.
  • Closest package root to slides.md
    Pros: No need to use a monorepo manager like PNPM, only nested package is required if there are multi slides in one package.
    Cons: Packages nested but not a monorepo is very confused.
  • Directory of slides.md (Before #1308)
    Pros: Easy to understand
    Cons: In the future maybe we can build multiple slides together, and this is not very suitable for that.

We also need to find the user's package.json (https://sli.dev/addons/use#use-addon).

@antfu, I am not very sure.

from slidev.

antfu avatar antfu commented on May 31, 2024 1

I would prefer to keep the original directory of slides.md approach. Later in the slides.md we could have a

---
rootDir: ..
---

to override that if needed

from slidev.

KermanX avatar KermanX commented on May 31, 2024

I think this is caused by #1308. In #1308, we assume that the project root is the closest folder to cwd with a package.json. To use slidev/slides/public as the public folder, you can add a package.json to slidev/slides.

(Before #1308, the project root (i.e. user root) was where the slides.md is)

from slidev.

Ynn avatar Ynn commented on May 31, 2024

Thank you for your quick reply :) . What should this minimal package.json contain. Does this mean that I'll have to "pollute" my slides directory with node_modules files on the side?

from slidev.

KermanX avatar KermanX commented on May 31, 2024

Thank you for your quick reply :) . What should this minimal package.json contain. Does this mean that I'll have to "pollute" my slides directory with node_modules files on the side?

I think { "name": "my-slides", "version": "0.0.0" } is enough.

from slidev.

Ynn avatar Ynn commented on May 31, 2024

Thanks for your help. That was what i first try but it does not seems to work. I have :

slidev
    |package.json
    |-- node_modules with all slidev dep & themes
    `-- slides
        |`-- public/images
        | style.css
        | my-slide.md
        | package.json

from slidev.

KermanX avatar KermanX commented on May 31, 2024

Could you share how you start Slidev dev server?

from slidev.

Ynn avatar Ynn commented on May 31, 2024

I was using :

npx slidev slides/slide.md --remote

but going inside the slide directory and doing :

npx slidev slide.md --remote

seems to work. I am not sure why. The only downside is that i have to have a package.json in my slide directory :)

For the context, i am trying to have all slidev env in a docker env : https://github.com/Ynn/slides.tools . Contrary to what tangramor /slidev_docker is doing i setup all the dependencies and modules inside the docker image to avoid having node_modules in my slides directory. I want to have something static as i don't want any surprise when editing or playing my slides.

I will try that and mark as fix if it works well. Would it be possible to have an option to change the root from the cli ? This way a package.json wouldn't be needed.

from slidev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.