Code Monkey home page Code Monkey logo

Comments (13)

SlexAxton avatar SlexAxton commented on May 26, 2024 1

Ooh, I can also confirm that if I change my .css.ts file to .vss.ts and import it as File.vss - then it is correctly inlined. So I think that should more or less narrow it down to packemon handling .css in a weird way.

from packemon.

milesj avatar milesj commented on May 26, 2024 1

@SlexAxton I just released 4.0.0-alpha.0, can you give that a shot?

from packemon.

milesj avatar milesj commented on May 26, 2024

I think the fact is that './Link.css' being a TS file under the hood is just bad design on their part. I'm not sure there's an easy way around this from Packemon's side, so I think I'll just add a setting to disable the asset stuff.

from packemon.

SlexAxton avatar SlexAxton commented on May 26, 2024

Potential middle ground would be control over that constant of asset file extensions.

from packemon.

SlexAxton avatar SlexAxton commented on May 26, 2024

I haven't changed any configuration, but by default I still have the same issue:

image image

Is there a flag or something I need to add?

from packemon.

SlexAxton avatar SlexAxton commented on May 26, 2024

task is:

type: 'library'
language: 'typescript'

tasks:
  build:
    command:
      - 'packemon'
      - 'pack'
      - '--addEngines'
      - '--declaration'
    inputs:
      - '@globs(sources)'
      - 'package.json'
      - 'tsconfig.*.json'
    outputs:
      - 'esm'

from packemon.

milesj avatar milesj commented on May 26, 2024

Whats the content of one of these css files, so I can test it thoroughly

from packemon.

SlexAxton avatar SlexAxton commented on May 26, 2024

Minimum viable .css.ts file is gonna be something like:

style.css.ts

import {style} from '@vanilla-extract/css';

export const redText = style({
  color: 'red',
});

Component.tsx

import {redText} from './style.css';

export const MyComponent = (props) => (
  <div className={redText} {...props} />
);

packemon.config.js

Then technically we'd also want to make sure these got built at build time. I have this configured, but it fails for the same reason with or without this configuration at the moment.

const {vanillaExtractPlugin} = require('@vanilla-extract/rollup-plugin');

module.exports = {
  rollupInput(config) {
    config.plugins.unshift(vanillaExtractPlugin());
  },
};

Result

The resulting build output without the plugin added should just be the .css.ts file is inlined as a module just like other .ts files.

The resulting build output with the plugin should more or less replace the contents of style.css.ts with:

export const redText = 'redtextclass-982398';

and then the rollup file also ends up generating a css output file at like esm/assets/src/style.css.ts.vanilla.css and it would have something like:

.redtextclass-982398 {color:red}

from packemon.

milesj avatar milesj commented on May 26, 2024

Thanks, will give this a shot.

from packemon.

milesj avatar milesj commented on May 26, 2024

Figured this out, will release shortly #240

from packemon.

milesj avatar milesj commented on May 26, 2024

Released 4.0.0-alpha.2

from packemon.

milesj avatar milesj commented on May 26, 2024

Fixed in v4

from packemon.

SlexAxton avatar SlexAxton commented on May 26, 2024

from packemon.

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.