changed main code to handle refactored js parsing API
This commit is contained in:
parent
478fec0000
commit
0f44431086
1 changed files with 10 additions and 3 deletions
|
|
@ -21,6 +21,7 @@ import qualified Development.Shake as Shake
|
|||
import Development.Shake.FilePath ((</>))
|
||||
import qualified Development.Shake.FilePath as FP
|
||||
import Templates
|
||||
import Text.Megaparsec (errorBundlePretty)
|
||||
import Types
|
||||
import Utilities.Action (getPublishedPosts, isDraft', markdownToHtml, markdownToPost, now, psbProgress)
|
||||
import qualified Utilities.CSS as CSS
|
||||
|
|
@ -92,9 +93,15 @@ css_resources =
|
|||
js_resources :: Rules ()
|
||||
js_resources =
|
||||
map (outputDir </>) jsGlobs |%> \target -> do
|
||||
src <- Shake.readFile' $ FP.dropDirectory1 target
|
||||
-- TODO: write to fingerprinted location as well
|
||||
Shake.writeFileChanged target $ JS.minify src
|
||||
let src_file = FP.dropDirectory1 target
|
||||
src <- Shake.readFile' $ src_file
|
||||
|
||||
let tokenization = JS.toTokens src_file src
|
||||
case tokenization of
|
||||
Left e -> error $ "Attempt to tokenize javascript file failed with: " <> errorBundlePretty e
|
||||
Right tokens ->
|
||||
-- TODO: write to fingerprinted location as well
|
||||
Shake.writeFileChanged target $ foldMap JS.displayToken $ JS.minify $ tokens
|
||||
|
||||
-- there's probably a better way of doing this that allows for the target's origin file extension to get passed in but for now we're doing brute force
|
||||
postsRule :: Rules ()
|
||||
|
|
|
|||
Loading…
Reference in a new issue