import { Injectable , Inject } from '@angular/core' ; import { PLATFORM_ID } from '@angular/core' ; import { isPlatformBrowser } from '@angular/common' ; import 'clipboard' ; import 'prismjs' ; import 'prismjs/components/prism-markup-templating' ; import 'prismjs/components/prism-css' ; import 'prismjs/components/prism-javascript' ; import 'prismjs/components/prism-jsx' ; import 'prismjs/components/prism-java' ; import 'prismjs/components/prism-markup' ; import 'prismjs/components/prism-typescript' ; import 'prismjs/components/prism-sass' ; import 'prismjs/components/prism-scss' ; import 'prismjs/components/prism-yaml' ; import 'prismjs/components/prism-php' ; declare var Prism ; @ Injectable ( ) export class HighlightService { constructor ( @ Inject ( PLATFORM_ID ) private platformId ) { } highlightAll ( ) { if ( isPlatformBrowser ( this . platformId ) ) { Prism . highlightAll ( ) ; } } }