Skip to content

Rettend/coffeescript-template

Repository files navigation

Babel CoffeeScript ESLint

Warning CommonJS require not working. Cannot access local files

CoffeeScript is a language that compiles into JavaScript. It adds syntactic sugar inspired by Ruby, Python, and Haskell in an effort to enhance JavaScript's brevity and readability. While also being almost as good as TypeScript.

No bracket jungle. No semicolons. No commas. No parentheses. No colons. No curly braces. No strings. No prototypes. No new keywords. No functions. No fat arrows. No var. No this. No that. No underbars. No confusion. No bullshit. (Copilot volt nem én)

# CoffeeScript
square = (x) -> x * x

// JavaScript
var square = function(x) {
  return x * x;
};

Usage

Installation

Install Node packages:

npm i

CoffeeScript is required to use coffee commands.

npm install -g coffeescript

Start compiling

Ctrl+Shift+B to start watching for changes. The compiled javascript will be in the dist folder.

Use with the Live Server extension

File structure

.
├── .vscode
│   └── tasks.json
├── dist
│   ├── modules
│   │   └── module.js
│   └── main.js
├── src
│   ├── modules
│   │   └── module.coffee
│   └── main.coffee
├── .babelrc
├── jsconfig.json
├── rollup.config.js

.vscode/tasks.json

  • This file is used by VSCode to run tasks. In this case, it is used to run the watch script in package.json.

dist

  • This folder contains the compiled javascript files.
  • Only the main.js file is used in the index.html file.

src

  • This folder contains the coffeescript files.

Warning when importing a module, add .js to the end of the path. NOT .coffee.

.babelrc

  • This file is used by Babel to compile the javascript files.
  • It sets modules to false so that ES modules are preserved (the import statements are not compiled to require statements).

jsconfig.json

  • Enable type checking for javascript (and coffeescript) files.

rollup.config.js

About

4 fun only

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published