question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

handlebars templates highlighting doesn't work

See original GitHub issue

`

import $ from 'jquery';

import Prism from 'prismjs/components/prism-core';
import 'prismjs/components/prism-markup';
import 'prismjs/components/prism-markup-templating';

import 'prismjs/components/prism-handlebars';
import loadLanguages from 'prismjs/components/index.js';

export class StyleHighlighter {

  constructor(){

      loadLanguages(['handlebars']);
      Prism.highlightAll();


  }

}

new StyleHighlighter();

`

The error is showing: Uncaught Error: Cannot find module './prism-markup'

Do you have a working version of latest handlbars template highlighting?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mAAdhaTTahcommented, Aug 3, 2018

This is probably a result of how your webpack is configured. If the css loaders only include css files within the project (e.g. Ignoring node_modules), it’ll ignore css dependencies and throw this error.

0reactions
agm1984commented, Jul 23, 2020

I found a solution for stubbing CSS files: https://stackoverflow.com/a/41851815/6141025

You can use moduleNameMapper to map *.css to the stub:

./jest.config.js

{
    "moduleNameMapper": {
        "\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.js"
    }
}

./mocks/styleMock.js

module.exports = {};

I was getting an error related to this issue and Prismjs:

    Details:

    .../node_modules/prismjs/plugins/line-highlight/prism-line-highlight.css:1
    pre[data-line] {
                   ^

    SyntaxError: Unexpected token '{'
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable syntax highlighting for *.handlebars files within ...
I know there is an extension which allows highlighting of handlebars templates within *.html files, however I require the naming convention of * ......
Read more >
Handlebars syntax highlighting does not take affect
Configuring the file extensions for Handlebars syntax highlighting does not take affect and the text does not receive any highlighting. Steps to ...
Read more >
WebStorm doesn't recognize and highlight inline Handlebars ...
I am working on a project that uses Ember.js. Our component integration tests use the hbs method from ember-cli-htmlbars to create tagged template...
Read more >
r/neovim - Proper Syntax highlighting for Javascript in HTML ...
I am working on a Vue app that is being injected via Handlebars. ... Syntax highlighting for Javascript in HTML template files via...
Read more >
Building your first Support app - Part 3: Creating and inserting ...
Open your iframe.html file and add the following <script> tag before all the other ... The template contains several Handlebars highlighted expressions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found