DEV Community

Francisco Cornejo Garcia
Francisco Cornejo Garcia

Posted on

3

Set up Eleventy with Bun

If you do not already have bun installed, install bun here for different ways to install.

In your terminal, we create a new project and hop in.
bun init will create a package.json file for you.

mkdir new-project
cd new-project
bun init
Enter fullscreen mode Exit fullscreen mode

Now we install Eleventy as a dev dependency.

bun add --dev @11ty/eleventy
Enter fullscreen mode Exit fullscreen mode

We create a file to try out.

echo '<h1>Hello World!</h1>' > index.html
Enter fullscreen mode Exit fullscreen mode

Compile and run Eleventy to generate a static file.

bunx @11ty/eleventy
Enter fullscreen mode Exit fullscreen mode

You should be able to see a new directory, _site, that contains your generated file.

How about we start up a hot-reloading local web server?

bunx @11ty/eleventy --serve
Enter fullscreen mode Exit fullscreen mode

Go to http://localhost:8080/ to see your file live!
You can make changes and save your file for your browser to auto-reload and see your new updates.

Learn more from the following resources.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (1)

Collapse
 
edo78 profile image
Federico "Edo" Granata

Ok, it's possible but do you have at least some benckmarks?

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site