Using TypeScript with Express and static files

Viewed 1073

I've created a simple Express application and I compile it to TypeScript using TypeScript compiler, then I run the JS compiled script. The problem is, when I tried to implement node-sass-middleware:

  app.use(
    sass({
      src: join(__dirname, "..", "src", "style"),
      dest: join(__dirname, "style"),
      debug: true,
    })
  );
  1. __dirname is equal to dist folder.
  2. Styles files aren't compiling, and the debug output is:
[sass]  skip: / nothing to do
[sass]  skip: /common/index.js nothing to do

App folder structure is:

src
  - common
      index.ts
  - style
      index.scss
  app.ts
  index.ts
  server.ts

dist
  - common
      index.js
  app.js
  index.ts
  server.ts

Can someone explain how to properly use TypeScript with Express.js with TypeScript to static compilation and Sass usage? Pretty please.

0 Answers
Related