Sha256: 8a4a68d420f1be3f5b441dcf9e13ca518e2f77d1bcbac8b327aa123b1f553ee4

Contents?: true

Size: 1.45 KB

Versions: 23

Compression:

Stored size: 1.45 KB

Contents

# Source maps

Source maps are available on most environments we support.

#### Processor `source_map_enabled` flag
To enable sourcemaps in the Sprockets processor you need to turn on the relative flag:

```ruby
Opal::Config.source_map_enabled = true # default
```


#### Sprockets debug mode

The source maps only work with Sprockets in debug mode - this is a limitation of Sprockets.

## Enable source maps

### Rails

Rails has debug mode already enabled in development environment with the following line from `config/environments/development.rb`:

```ruby
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
```

`opal-rails` also enables sourcemaps in development so with the standard setup you ready to go.


### Sinatra

You can add `Opal::Server` as in the official example: [sinatra/config.ru](https://github.com/opal/opal/blob/master/examples/sinatra/config.ru).

### Opal::Server

`Opal::Server` (which is based on Sprockets) implements sourcemaps and can be used alone or with `Rack::Cascade` in conjunction with other apps.

### Opal::SimpleServer

Like `Opal::Server`, `Opal::SimpleServer` (which isn't based on Sprockets) implements sourcemaps properly.

### Opal::Builder

`Opal::Builder` is a bit lower level and doesn't support source maps by itself. It requires you to call in a specific method to generate them yourself.

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 docs/source_maps.md
opal-1.8.2 docs/source_maps.md
opal-1.8.1 docs/source_maps.md
opal-1.8.0 docs/source_maps.md
opal-1.8.0.beta1 docs/source_maps.md
opal-1.7.4 docs/source_maps.md
opal-1.8.0.alpha1 docs/source_maps.md
opal-1.7.3 docs/source_maps.md
opal-1.7.2 docs/source_maps.md
opal-1.7.1 docs/source_maps.md
opal-1.7.0 docs/source_maps.md
opal-1.7.0.rc1 docs/source_maps.md
opal-1.6.1 docs/source_maps.md
opal-1.6.0 docs/source_maps.md
opal-1.6.0.rc1 docs/source_maps.md
opal-1.6.0.alpha1 docs/source_maps.md
opal-1.5.1 docs/source_maps.md
opal-1.5.0 docs/source_maps.md
opal-1.5.0.rc1 docs/source_maps.md
opal-1.4.1 docs/source_maps.md