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

Add support for content script and popup window #30

Open
dantheman3333 opened this issue Jun 25, 2017 · 3 comments
Open

Add support for content script and popup window #30

dantheman3333 opened this issue Jun 25, 2017 · 3 comments

Comments

@dantheman3333
Copy link

dantheman3333 commented Jun 25, 2017

Possible approach: because scala-js can only compile to one js file (along with a dependency js file), I think the content script and popup window should be different sbt projects - bringing the total to three.

The content script and popup projects can be normal scala-js projects and only require the ScalaJSPlugin.

In the scala-js-chrome project, the build.sbt will specify the the two other projects. The ChromeSbtPlugin will compile the content and popup projects and move their outputted js files to the correct build directory. The manifest.json will have to be modified as well.

I made a poc of creating three different projects and manually copying over the necessary files with an ugly shell script https://github.com/kramer425/scala-js-chrome-extension-example

@lucidd
Copy link
Owner

lucidd commented Jun 27, 2017

I like the general idea of that. Do you think it would be possible instead of referencing the whole project to only reference a task that results in a file and have that potentially from another project? This would still leave the possibility of referencing the same project if someone wants to include everything in one.

@dantheman3333
Copy link
Author

It would be great if it could be one project. Though, I have limited knowledge of sbt - are you suggesting that one task that calls chromeBuildOpt on a directory, and two that call fastOptJS/fullOptJS on other directories?

@lucidd
Copy link
Owner

lucidd commented Jun 28, 2017

Currently we have something like val fullOptJsLib = TaskKey[Attributed[File]]("fullOptJsLib") which can be set to a task that produces a file. I think it may be possible to also set it to reference a task from another project to pull in that file during building. So i think we could provide additional settings for content scripts and such which the user can set to whatever task he wants including from different projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants