Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow files to be included in the sandbox at comile time #1340

Closed
fgaray opened this issue May 24, 2020 · 1 comment
Closed

Allow files to be included in the sandbox at comile time #1340

fgaray opened this issue May 24, 2020 · 1 comment

Comments

@fgaray
Copy link

fgaray commented May 24, 2020

Is your feature request related to a problem? Please describe.

I am creating a website in a monorepo using yesod and I am trying to include bootstrap (the css framework) in the binary. My repo structure is like this:

//third_party/bootstrap/css
//src/haskell/web

I tried using a filegroup and data into the build sandbox but It looks like bootstrap is only available at run time and not at compile time making impossible to use the template haskell helpers that are available in Yesod.

Describe the solution you'd like

I would like to have bootstrap.css at compile time so I can use mkEmbeddedStatic to embed the css into a Haskell library that I can use from other parts of the repo.

An environment variable that could point to this css (or any other static file) could also be an alternative.

Describe alternatives you've considered

I tried using filegroup to export the css from the third party directory and importing it into my haskell library. Running the following code in the library I was unable to find the css use it in mkEmbeddedStatic.

test :: Q [Dec]                                                                                                                                                                                                     
test = do                                                                                                                                                                                                           
    liftIO $ do                                                                                                                                                                                                     
        output <- readProcess "tree" [] []                                                                                                                                                                          
        putStrLn output                                                                                                                                                                                             
    return []

I also tried using "data" to point to the css. I was also unable to find there the css.

Additional context

So, I am relative new to bazel so I am not sure if this use case is already covered by other methods or not or how much it is specific related to the haskell rules or it is more a general bazel issue. I could also help with the implementation of this with a few hints as I am not really familiar with the internals of bazel.

@fgaray
Copy link
Author

fgaray commented May 24, 2020

So, I just realized that you can use "extra_srcs" to add the filegroup at compile time as it is explained in #1337 and it solved my use case.

Sorry for the noise!, I will close the issue.

@fgaray fgaray closed this as completed May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant