Maintain your client-side rule readable and debuggable even with you have combined, minified or compiled it. Use supply maps to map your supply rule to your put together rule.
- Utilize supply Maps to map code that is minified supply rule. Then you’re able to read and debug put together rule in its initial supply.
- Only utilize preprocessors with the capacity of creating supply Maps.
- Verify that the web host can provide supply Maps.
Begin with preprocessors
Make use of a supported preprocessor
You should utilize a minifier that is effective at creating source maps. For the many options that are popular see our preprocessor help part. For an extensive view, begin to see the supply maps: languages, tools along with other information wiki page.
The next types of preprocessors are generally utilized in combination with supply Maps:
Supply Maps in DevTools Sources panel
Source Maps from preprocessors cause DevTools to load your initial files along with your minified people. Afterward you make use of the originals to create breakpoints and move through rule. Meanwhile, Chrome is really operating your minified rule. Thus giving you the impression of managing a development site in manufacturing.
Enable Source Maps in settings
Debugging with Source Maps
When debugging your source and code Maps enabled, supply Maps will show in 2 places:
- When you look at the system (the hyperlink to supply ought to be the initial file, not the one that is generated
- Whenever stepping through rule (backlinks within the call stack should start the source file that is original
The@sourceURL allows you to make development much easier when working with evals while not part of the source Map spec. This helper appears quite similar in to the //# sourceMappingURL property and it is really mentioned when you look at the Source Map V3 specifications.
By like the after unique comment in your code, that will be evaled, it is possible to name evals and inline scripts and designs so that they appear as more rational names in your DevTools.
Navigate for this demo, then:
- Start the DevTools and go right to the Sources panel.
- Type in a filename in to the true name your rule: input industry.
- Click the compile button.
- An alert will appear with the sum that is evaluated the CoffeeScript supply.