add-template-mapping.js 512 B

12345678910111213141516171819
  1. const splitRE = /\r?\n/g
  2. module.exports = function addTemplateMapping (content, parts, output, map, beforeLines) {
  3. var afterLines = output.split(splitRE).length
  4. var templateLine = content.slice(0, parts.template.start).split(splitRE).length
  5. for (; beforeLines < afterLines; beforeLines++) {
  6. map.addMapping({
  7. source: map._hashedFilename,
  8. generated: {
  9. line: beforeLines,
  10. column: 0
  11. },
  12. original: {
  13. line: templateLine,
  14. column: 0
  15. }
  16. })
  17. }
  18. }