Sha256: 19b40cb933106ebb726b370977a4c6f43fc5532a9d46560ed32f119493feeb41

Contents?: true

Size: 1.57 KB

Versions: 39

Compression:

Stored size: 1.57 KB

Contents

# Source maps

Source maps are available (on current stable release, v0.6.x) even without explicit support from Sprockets in a sort of hackish way.

_As such even if they generally work fine there are some limitations and edge case issues._

NOTE: Currently on `master` branch sourcemaps are work-in-progress and probably will integrate with the upcoming Sprockets 4 that has integrated support for them.

#### 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  sourcemaps only work with Sprockets in debug mode because they are generated just for single files.


## 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/0-6-stable/examples/sinatra/config.ru).

### Opal::Server

`Opal::Server` implements sourcemaps and can be used alone or with `Rack::Cascade` in conjunction with other apps.

### Opal::Environment

`Opal::Environment` is a bit lower level and doesn't support source maps by itself.

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
opal-0.11.1 docs/source_maps.md
opal-0.11.1.pre docs/source_maps.md
opal-0.10.6 docs/source_maps.md
opal-0.10.6.beta docs/source_maps.md
opal-0.11.0 docs/source_maps.md
opal-0.10.5 docs/source_maps.md
opal-0.10.4 docs/source_maps.md
opal-0.11.0.rc1 docs/source_maps.md
opal-0.10.3 docs/source_maps.md
opal-0.10.2 docs/source_maps.md
opal-0.10.1 docs/source_maps.md
opal-0.10.0 docs/source_maps.md
opal-0.10.0.rc2 docs/source_maps.md
opal-0.10.0.rc1 docs/source_maps.md
opal-0.10.0.beta5 docs/source_maps.md
opal-0.10.0.beta4 docs/source_maps.md
opal-0.10.0.beta3 docs/source_maps.md
opal-0.10.0.beta2 docs/source_maps.md
opal-0.10.0.beta1 docs/source_maps.md