site: copy instead of symlinking source files so hakyll preview works
This commit is contained in:
		
							parent
							
								
									50dc810013
								
							
						
					
					
						commit
						4123d458c8
					
				| @ -12,7 +12,10 @@ import           Text.Pandoc.Options | |||||||
| import           Text.Printf | import           Text.Printf | ||||||
| 
 | 
 | ||||||
| main = do | main = do | ||||||
|  |   -- preview doesn't detect changes in symlinked files | ||||||
|   symlinkPagesFromParentDir |   symlinkPagesFromParentDir | ||||||
|  |   -- copyPagesFromParentDir | ||||||
|  | 
 | ||||||
|   symlinkProfsDir |   symlinkProfsDir | ||||||
|   hakyll $ do |   hakyll $ do | ||||||
|     match ("images/*" .||. "js/**" .||. "robots.txt") $ do |     match ("images/*" .||. "js/**" .||. "robots.txt") $ do | ||||||
| @ -42,8 +45,12 @@ main = do | |||||||
|           >>= relativizeUrls |           >>= relativizeUrls | ||||||
| 
 | 
 | ||||||
| symlinkPagesFromParentDir = do | symlinkPagesFromParentDir = do | ||||||
|  |   filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".." | ||||||
|  |     >>= mapM_ (\f -> system $ printf "[ -f %s ] || ln -s ../%s" f f) | ||||||
|  | 
 | ||||||
|  | copyPagesFromParentDir = do | ||||||
|   fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".." |   fs <- filter (".md" `isSuffixOf`) `fmap` getDirectoryContents ".." | ||||||
|   forM_ fs $ \f -> system $ printf "[ -f %s ] || ln -s ../%s" f f |   forM_ fs $ \f -> system $ printf "cp ../%s ." f | ||||||
| 
 | 
 | ||||||
| symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs" | symlinkProfsDir = ensureSiteDir >> system "ln -sf ../../profs _site/profs" | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user