Use PrismJS with RequireJS, even though it's not a dependency
I'm trying to use PrismJS while not attaching it as a strict dependency to
any functions. All iI needed it to do is render the syntax highlighting on
the page but, unfortunately, the full styling isn't being passed to the
page.
I did read this SO thread and confirmed that Prism is attached to the
window object, but the styling isn't showing up on the page.
Here's my code (prism.css is concatenated with other styles via Sass):
The HTML:
<pre><code class="language-css">
git rm 'myFile.html'
</code></pre>`
The script tag:
<script data-main="/js/config.js" src="/js/require.js"></script>
config.js
requirejs.config({
baseUrl: "/js",
deps: ["prism"],
paths: {
prism: "vendor/prism"
},
shim: {
"prism": {
"exports": "Prism"
}
}
});
prism.js
define("prism", ["prism"],function(Prism) {
return Prism; //probably redundant
});
I have a feeling that doing something in prism.js is what's needed, but am
not 100% sure.
No comments:
Post a Comment