Skip to content

Support module transformers #11502

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

Closed
raix opened this issue Oct 10, 2016 · 3 comments
Closed

Support module transformers #11502

raix opened this issue Oct 10, 2016 · 3 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@raix
Copy link

raix commented Oct 10, 2016

Proposal for adding support for transformation of non ts modules,

Example: a npm typescript-css-module, defining following module, idea:

index.d.ts

declare module "*.css" {
    // exposes the classnames definitions and transforms and adds the css
    // to the css bundle/file
    export default transformer 'index.ts';
}

index.ts

  // css-module-transformer
  export default function(context: TransformationContext) {
    // parse the css file, make classnames uniq, add the css to a target css file
    // add source map files
    // and produce a ts file mapping classnames for type checking and autocomplete
  }
@mhegazy
Copy link
Contributor

mhegazy commented Oct 10, 2016

Why not have a tool that creates a .d.ts file given a .css and include this into your compilation?

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Oct 10, 2016
@raix
Copy link
Author

raix commented Oct 11, 2016

@mhegazy that might be the best to use something like typed-css-modules, keeping tsc strictly for ts

The initial idea was to avoid all the setup of webpack/loaders etc. being able to compile modules without to much hassle. I'll close this as not relevant

@raix raix closed this as completed Oct 11, 2016
@mohsen1
Copy link
Contributor

mohsen1 commented Dec 4, 2016

This is actually a great proposal! Using typed-css-modules with webpack hasn't been easy.

TypeScript compiler emits JS files, it would be awesome if we could hook into module loading and provide type definition to compiler for non-TS files for autocomplete etc and in compile time we emit non-JS files.

I love to use TypeScript compiler to do things I do with Webpack. I wish TypeScript had APIs to enable doing stuff like this.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

3 participants