import map template
This commit is contained in:
		
							parent
							
								
									3e4e292a23
								
							
						
					
					
						commit
						ae9aa17e37
					
				
					 1 changed files with 30 additions and 0 deletions
				
			
		
							
								
								
									
										30
									
								
								layouts/partials/resources/importmap.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								layouts/partials/resources/importmap.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
{{ $imports := dict }}
 | 
			
		||||
 | 
			
		||||
{{ if eq 0 1 }}
 | 
			
		||||
  {{ with $tsModuleResources := resources.Match "scripts/modules/*/*" }}
 | 
			
		||||
    {{ range $tsModuleResources }}
 | 
			
		||||
      {{ $resource := . }}
 | 
			
		||||
      {{ if eq (path.Ext .) ".ts" }}
 | 
			
		||||
        {{ $resource = . | js.Build }}
 | 
			
		||||
      {{ end }}
 | 
			
		||||
 | 
			
		||||
      {{/*
 | 
			
		||||
      Create imports for these scripts that look like $dirname/$basename
 | 
			
		||||
      where basename doesn't have the extension
 | 
			
		||||
      */}}
 | 
			
		||||
      {{ $directoryBasename := path.Base (path.Dir $resource) }}
 | 
			
		||||
      {{ $key := path.Join $directoryBasename (path.BaseName $resource) }}
 | 
			
		||||
 | 
			
		||||
      {{ $imports = merge $imports (dict $key $resource.RelPermalink) }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
  {{ end }}
 | 
			
		||||
{{ else }}
 | 
			
		||||
  {{ $imports = dict "modules/" "scripts/modules/" }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
 | 
			
		||||
{{ $importmap := dict }}
 | 
			
		||||
{{ if gt (len $imports) 0 }}
 | 
			
		||||
  {{ $importmap = dict "imports" $imports }}
 | 
			
		||||
{{ end }}
 | 
			
		||||
 | 
			
		||||
{{ return $importmap }}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue