Code Monkey home page Code Monkey logo

Comments (6)

yusukebe avatar yusukebe commented on September 13, 2024 2

I'm trying to use Remix on Hono's Vite dev-server. In that app, it can support "css side-effects imports" which is a matter of this issue:

https://github.com/yusukebe/hono-and-remix-on-vite/blob/ff51520bf0f8f42896ae0d4bacf596d2cb216331/app/root.tsx#L3

So, we may make it by referring to Remix.

from honox.

yusukebe avatar yusukebe commented on September 13, 2024 1

Hi @ryuapp !

Thanks for the suggestion. I've implemented the feature of the Script component to support it: #93. How about this?

from honox.

yusukebe avatar yusukebe commented on September 13, 2024 1

Hi @ryuapp

Can you share the example using Tailwind CSS with this PR? I want to know the setting. Using PostCSS?

from honox.

emmanuelchucks avatar emmanuelchucks commented on September 13, 2024 1

@ryuapp consider importing css this way

import styles from "../style.css?url"

export default jsxRenderer(async ({ title, children }) => {
  return (
    <html lang="en">
      <head>
        ...
        <link href={styles} rel="stylesheet" />
        ...
      </head>
      ...
    </html>
  )
})

and updating your vite.config.ts

export default defineConfig(({ mode }) => {
  if (mode === "client") {
    return {
      plugins: [client()],
    }
  }

  return {
    plugins: [honox(), pages()],
    build: {
      assetsDir: "static",
      ssrEmitAssets: true,
    },
  }
})

from honox.

ryuapp avatar ryuapp commented on September 13, 2024

Thank you, @yusukebe!
Allow me to comment on just two points.

  1. FOUC(flash of unstyled content)
    I save files or reload a screen every time, a flicker occurs on dev mode.
    Without this, the PR is a good DX.

  2. Only Global Style?
    I don't have a problem as long as I can easily import tailwindcss, but there may be times when we want to load a css file only on a specific page. Therefore, I think it's best to be able to import it within files of routes directory.

Even with the current PR, that meets my demands!

from honox.

ryuapp avatar ryuapp commented on September 13, 2024

@emmanuelchucks
I prefer it to the current config.
I currently use that config, but in the future I would like to configure it only with the import syntax.
Thank you!

from honox.

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.