npm install --save-dev gulp-racket
Official repo: https://github.com/racketscript/racketscript
git clone https://github.com/racketscript/racketscript.git
cd racketscript
# (Optional: checkout to a specific branch or version)
raco pkg install --auto racketscript
Note:
If you use snap/flatpak or another way to install Racket, make sure theraco
command works and the package is installed for the correct Racket version.
The racks
executable is located in racketscript/racketscript-compiler/bin
.
Add this folder to your PATH for your session (replace /path/to/racketscript
with your actual path):
export PATH="$HOME/path-to-your-project/racketscript/racketscript-compiler/bin:$PATH"
You can add this line to your
~/.bashrc
,~/.zshrc
, or~/.config/fish/config.fish
so it is always available.
Run:
racks --help
You should see the RacketScript Compiler command help.
Example:
const gulp = require('gulp');
const racket = require('gulp-racket');
gulp.task('default', () =>
gulp.src('src/index.rkt')
.pipe(racket())
.pipe(gulp.dest('dist'))
);
-
racks
command not found:
Make sure your PATH includesracketscript/racketscript-compiler/bin
. -
Complex numbers error:
Complex numbers are not supported by JavaScript; rewrite your code to avoid them. -
JS doesn't work in the browser:
The generated JS uses ES6 modules and runtime files. Use<script type="module">
and run through a local server.
import racketTransform from 'gulp-racket';
const racket = () => {
return gulp
.src('./src/*.rkt')
.pipe(racketTransform(`./example/dist`))
.pipe(gulp.dest(`./example/dist`));
};