Giter Site home page Giter Site logo

untyped / sbt-plugins Goto Github PK

View Code? Open in Web Editor NEW
74.0 74.0 23.0 4.44 MB

SBT plugins for Javascript, Coffeescript, LESS, SASS, and Mustache compilation

Scala 3.26% Java 0.29% JavaScript 48.16% CoffeeScript 0.01% CSS 4.04% Ruby 44.23% HTML 0.01% Smarty 0.01%

sbt-plugins's People

Contributors

andreykl avatar countingtoten avatar crisson avatar heralight avatar joescii avatar rkaercher avatar shikhar avatar thatsmydoing avatar torbjornvatn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sbt-plugins's Issues

Scala 2.11 and SBT 0.13.5

Should it work on configuration in title?

If no then what are plans on moving it to this configuration?

Seems to compile more than it needs to?

When I have a .jsm and attempt to include only the .jsm by setting the includeFilter, sbt-js looks like it goes ahead and compiles all of the .js files referred to by the .jsm separately anyway. Is this as intended?

Using compass with sbt-sass

I have not found a way to use compass with this plugin. Looking at Plugin source code I haven't found a way to provide any options to the sass compiler. What I would like to do is to pass in the "--compass" parameter and maybe that would work.

Or am I missing something?

Cannot get sbt-scripted tests to pass from development

I am unable to get the scripted tests to pass on my local machine by following the steps on the README. The first thing that appears necessary changing the version to *-SNAPSHOT per Eugene's blog. Then I changed all of the test project's versions to SNAPSHOT as well. It appears that the publishing doesn't happen automatically, so I manually published the snapshots. That got me to the point I'm at now, where I always get errors due to the project.sbt files which only contain ../../plugins.sbt. Perhaps I'm missing another step. Below is the error:

[error] C:\Users\jbarnes\AppData\Local\Temp\sbt_8a143aaa\compile-error\project\plugins.sbt:1: error: illegal start of simple expression
[error] ..\..\plugins.sbt
[error] ^
[info] [error] Error parsing expression.  Ensure that there are no blank lines within a setting.

Yes, that is Windows that I'm sentenced to.

Anyway, let me know if there is a step I am missing. I'll help update the documentation if you'd like. I have a few feature requests that I'm about to submit that I'll gladly work on once I can test.

Thanks!
Joe

Improve performance of CSS Processor

The performance of the sbt-untyped LESS processor seems to take quite a bit of time for non trivial cases. I believe this may be due to the fact that it manually does dependency management on its own instead of using LESS's own dependancy management

This can probably be when we upgrade to LESS 1.5.x

New feature: GZip JS

Feature Request: I think it'd be really useful to be able to instruct sbt-js to provide gzipped versions of compiled js. Specifically I mean turning src/main/javascript/xxx.js into war/xxx.js and war/xxx.js.gz.

Using Jetty's org.eclipse.jetty.servlet.DefaultServlet if abc.js is requested, abc.js.gz will be sent if it is found in the WAR. For static content this saves greatly reduces bandwidth without any cost to server-sde CPU/mem.

How do I set Jetty version to 7+

I tried to put this into my Build.scala:

RunModeKeys.jettyVersion.in(Production) := JettyVersion.Jetty7Plus

  • but it didn't work.

I had a look into the plugin at def runModeSettingsIn()
jettyVersion := JettyVersion.Jetty6,

Shouldn't this rather be
jettyVersion := RunModeKeys.jettyVersion,

or am I missing something?

Is there an easy way to define my own settings? I'd like to be able to do "test:package" and getting a xml-file with run-mode set to "test"

Cheers,
Max

Support optional file name suffix for target files.

In order to avoid production cache hits on old versions of assets, these plugins should support versioning the files via an optional file name suffix like sbt-closure. This will also allow the plugin users to add .min to the file names to distinguish the compiled js from the original for instance.

Generate both .js and .min.js

As far as I can see, the options for minification are either to minify or to not minify. If I'm making a JS library, I don't want to decide this at compile-time; I want to produce both artifacts and let the user decide whether to use the minified version.

Is there currently a way to generate both?

And why not just generate both by default?

sbt-js: how to use externs

hi,

i'm curious how to use externs with sbt-js? is there any possibility?

my sbt-js version is 0.6-M5

thx

add yui-compress to sbt-less

add yui-compress to compress settings in sbt-less project.

gain example in less-1.3.0 test (with lesscssc):
92631 2012-04-23 17:18 bootstrap-normal.css
81150 2012-04-23 17:18 bootstrap-compress.css
77985 2012-04-23 17:18 bootstrap-yuicompress.css

Retain CoffeeScript output

A nice enhancement for the sbt-js plugin would be the ability to retain the JS output by the CoffeeScript compiler. Initially I would expect this to be possible given the option to pretty print the javascript, but after configuring the my project to use the plugin I only see the closure-compiled output. In conjunction with issue #55, it will be possible to serve the pretty-printed js in development and the minified js in production.

Problem resolving sbt-js plugin

I've followed the initial steps in README.md, selecting version 0.8, but am unable to download the plugin. Here's the relevant sbt output, with references to other repos removed:

 92 [warn]  [FAILED     ] com.untyped#sbt-js;0.8!sbt-js.jar:  (0ms)
...
 99 [warn] ==== jcenter: tried
100 [warn]   https://jcenter.bintray.com/com/untyped/sbt-js_2.10_0.13/0.8/sbt-js-0.8.jar
101 [warn] ==== public: tried
102 [warn]   https://repo1.maven.org/maven2/com/untyped/sbt-js_2.10_0.13/0.8/sbt-js-0.8.jar
103 [warn] ==== Untyped Bintray: tried
104 [warn]   https://dl.bintray.com/untyped/maven/com/untyped/sbt-js_2.10_0.13/0.8/sbt-js-0.8.jar
...

This failure isn't surprising: I see the jar in the documented repository, but without Scala and sbt version numbers: https://dl.bintray.com/untyped/maven/com/untyped/sbt-js/0.8/sbt-js-0.8.jar

Has the plugin been published incorrectly, or do I need to take some other sbt configuration steps?

FWIW, I'm running sbt-version 0.13.9 and Scala version 2.11.7.

Change destination causing all the src code being deleted

I have some code located in

src/main/resources/web/js/template directory

I was hoping to out the concatenate the js files in that directory into the same directory so I can directly include the generated file in index.html. I play around with the destination directory and end up with this :

(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)( _ /"." )

This works, the concat file is indeed generated to that directory.

but when I run sbt clean

All the directories under src are wipe out, including the main/resources etc.
I assume this behavior is due to the assumption that you wan to cleanup all generated files.
I think that's OK, except it clean up all the source code as well.

I tried
(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)( _ /"resources" / "web" / "js" / "template" )

but with that, the sbt-js insert all the parent structure into src/main/resources/web/js/template directory
so that generated structure becomes:

src/main/resources/web/js/template/resources/web/js/template

sbt-js creating recursive directory structure

with this setting
(resourceManaged in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)(_ / "webapp"),

running js command will created nested directories

js
[info] Compiling sbt-js source /Users/guillaumemasse/Project/ScalaKata/src/main/webapp/js/kata.js
[success] Total time: 1 s, completed Jul 13, 2013 3:37:56 PM
js
[info] Compiling sbt-js source /Users/guillaumemasse/Project/ScalaKata/src/main/webapp/webapp/js/kata.js
[success] Total time: 0 s, completed Jul 13, 2013 3:37:59 PM
js
[info] Compiling sbt-js source /Users/guillaumemasse/Project/ScalaKata/src/main/webapp/webapp/webapp/js/kata.js
[success] Total time: 0 s, completed Jul 13, 2013 3:38:45 PM

sbt-version
[info] 0.12.3

VariableRenamingPolicy.NONE

In README is reported :

Or to turn variable renaming off altogether:

(JsKeys.variableRenamingPolicy in (Compile, JsKeys.js)) := VariableRenamingPolicy.NONE

but correct value is VariableRenamingPolicy.OFF at least in the last version

Rework Lift support

Specifically sourcing feedback from Lift people (@d6y, @jonoabroad, others) on this ticket.

Is this functionality that the wider Lift community needs? Or are others already doing this better? I'll rework/retire functionality as appropriate.


The sbt-runmode plugin currently serves two purposes:

  • install an appropriate jetty-web.xml file for any given run mode;
  • configure sbt-js, sbt-less, and so on (if present) with appropriate defaults
    for each run mode.

The plugin adds new Configurations to SBT for Lift run modes such as development, test, pilot, and so on. In other words, it generally behaves in a non-standard way. I suspect that the plugin isn't widely used for this reason.

I want to rework this for a 0.7 release. A simpler solution would be as follows:

  • implement runmode switching using a command-line parameter and system
    property as suggested by @seanparsons in issue #36;
  • have sbt-runmode be responsible for switching jetty-web.xml but drop its ability
    to configure the other plugins in this repo;
  • add Lift-specific default configurations to the other plugins that look for the same
    system property and command-line parameter.

This would allow you to drop all the relevant plugins into your build and use a single command line parameter to configure SBT for a development, pilot, or production release.

For example, you could have this in plugins.sbt:

addSbtPlugin("com.untyped" % "sbt-js"       % <<VERSION>>)

addSbtPlugin("com.untyped" % "sbt-less"     % <<VERSION>>)

addSbtPlugin("com.untyped" % "sbt-runmode"  % <<VERSION>>)

and this in build.sbt:

seq(jsSettingsForLift : _*) // set up JS/Coffee compilation

seq(lessSettingsForLift : _*) // set up Less CSS compilation

seq(runmodeSettings : _*) // install correct version of jetty-web.xml

and create a pilot build like this:

$ sbt -Drunmode=pilot package

I need guidance on the best default settings for the project. Something like this seems appropriate but it depends on what the wider community uses:

src
 - main
   - resources // jetty-web.xml goes here (IIRC)
   - js // source JS/Coffee goes here
   - css // source LESS/CSS goes here
   - scala
   - webapp
     - static
       - js // compiled JS goes here
       - css // compiled CSS goes here

In less, call Mustache before parse @import and add run.mode.development etc.

Hi!

Very good new features in "0.6-M1", Thank you!

I try to use the best way Mustache, less, js and runMode.

My case (some feature with Js):

  • Lift Application
  • Twitter bootstrap with std css
  • a custom custom-bootstrap.less (only some sub-module)
  • A file app-styles.template.less with reference to bootstrap

In Development mode:

use of the std bootstrap (in twitter archive) css by css normal import in app-styles.template.less (actually can be done by adding 2 " " between @import and path.)

In Production mode:

use @import "custom-bootstrap.less" to inline in app-styles.template.less

What I did:

  • add run.mode.development=true and run.mode.production=true in development and production properties => OK
  • In app-styles.template.less:
    {{#run.mode.development}}
    @import "../../../modules/bootstrap/bootstrap/css/bootstrap.css";
    @import "../../../modules/bootstrap/bootstrap/css/bootstrap-responsive.css";
    {{/run.mode.development}}
    {{#run.mode.production}}
    @import "bootstrap.prod.less";
    @import "bootstrap-responsive.prod.less";
    {{/run.mode.production}}

The problem:

Conditions are good, but @import is parsed before the Mustache and imports are always included.

What I suggest:

  • Add to runMode.Props by default properties like run.mode.development=true and run.mode.production=true, ...etc.
  • Parse Mustache template before imports.
  • or apply exclude filter on @import input.
  • same things for sbt-js

other suggestions:

  • Instead of LessKeys.useCommandLine in (Development, LessKeys.less) := true, add support for external command like : LessKeys.useCommandLine in (Development, LessKeys.less) := "recess --compress"
  • same things for sbt-js to support external command like "uglifyjs -c"

Thanks,

Alexandre

Using the less's @import statement

I am not sure if I am doing something ridiculously stupid, but it appears that less's @import and @import-once statements are not working with version 0.5 of sbt-less plugin

Assuming I have a flat directory called less with my build.sbt looking as follows

seq(lessSettings : _*)

(sourceDirectory in (Compile, LessKeys.less)) <<= (sourceDirectory in Compile)(_ / "less")

(resourceManaged in (Compile, LessKeys.less)) <<= (resourceManaged in (Compile, LessKeys.less))(_ / "css")

(resourceGenerators in Compile) <+= (LessKeys.less in Compile)

(compile in Compile) <<= compile in Compile dependsOn (LessKeys.less in Compile)

(LessKeys.prettyPrint in (Compile, LessKeys.less)) := true

(webappResources in Compile) <+= (resourceManaged in Compile)(_ / "css")

Assuming I have 2 files within the less folder, a.less and b.less, if a.less simply contains the following

@import "b";

It fails with
could not unshadow /Users/mdedetrich/scala/test/src/main/less/b

Using @import-once instead of @import I get
JavaException: java.io.FileNotFoundException: /Users/mdedetrich/scala/test/b.less (No such file or directory)

Obviously the files compile fine if there is no @import or @import-once

Error "could not unshadow " on js compilation

I'm getting the error :

(compile:jsSourceGraph) could not unshadow /home/max/dev/main sandbox/ckor/public/js/\

(see full stack trace below)

I'm having a hard time to decipher the meaning.

The relevant part of my Build.scala is :

  val sbtJs =
    (sourceDirectories in (Compile, JsKeys.js)) <<=
      (baseDirectory in Compile) {
        srcDir => {
          Seq(
            srcDir / "public" / "js"
          )
        }
      }

val main =
  play.Project(appName, appVersion, appDependencies)
    .settings(scalaVersion := "2.10.3")
    .settings(jsSettings : _*)
    .settings(sbtJs)
    .settings((includeFilter in JsKeys.js) := "*.jsm")
    .settings((compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile))

Full stack trace :

    [trace] Stack trace suppressed: run last compile:jsSourceGraph for the full output.
    [error] (compile:jsSourceGraph) could not unshadow /home/max/dev/main-sandbox/ckor/public/js/\
    [error] Total time: 0 s, completed Jan 19, 2014 11:23:04 AM
    [cogo] $ last compile:jsSourceGraph
    [debug] sbt-js template properties {}
    java.lang.RuntimeException: could not unshadow /home/max/dev/main-sandbox/cogo/public/js/\
        at scala.sys.package$.error(package.scala:27)
        at com.untyped.sbtgraph.Graph$$anonfun$unshadowSourceFile$1.apply(Graph.scala:61)
        at com.untyped.sbtgraph.Graph$$anonfun$unshadowSourceFile$1.apply(Graph.scala:61)
        at scala.Option.getOrElse(Option.scala:120)
        at com.untyped.sbtgraph.Graph$class.unshadowSourceFile(Graph.scala:61)
        at com.untyped.sbtjs.Graph.unshadowSourceFile(Graph.scala:11)
        at com.untyped.sbtgraph.Graph$class.getSource(Graph.scala:44)
        at com.untyped.sbtjs.Graph.getSource(Graph.scala:11)
        at com.untyped.sbtgraph.Graph$class.getSource(Graph.scala:37)
        at com.untyped.sbtjs.Graph.getSource(Graph.scala:11)
        at com.untyped.sbtjs.JsmSource$$anonfun$parents$3.apply(JsmSource.scala:11)
        at com.untyped.sbtjs.JsmSource$$anonfun$parents$3.apply(JsmSource.scala:10)

excludeFilter not working

Trying to exclude a directory...
excludeFilter in JsKeys.js := new FileFilter{ def accept(f: File) = ".*js/lib/_src/.*".r.pattern.matcher(f.getAbsolutePath).matches }

SBT-JS 0.7 Closure question

Hi,

Just started using the Closure Compiler through SBT. The setup worked quickly, but it seems goog.provide and goog.require statements do not work as the plugin is passing every single JS file individually to the compiler.

Is this a correct assumption?

Regards.

Slightly complex setup question

Hi
I have a Lift module - FoBo (its a generic front end toolkit module) that users your sbt-less to compile some css resources and it works great but the setup is not optimal.
Normal usage of this FoBo Lift module is to include it as a library dependency in the user projects build.sbt and so it potential dose not require the user to have direct access to the modules source code (although this is the only current way as it is not published to any public repository yet).

Ultimately it would be great to let the user rule there own variables.less file in there own target project and reference the builder .less /@include files available as resources from within the FoBo module (.jar).

Wile trying to manage this setup I have concluded that moving the whole less setup from the module and overriding the target .css file that comes from the FoBo module is no problem and results is as expected. But when trying to externalise the builder .less/ @include files into the fobo jar (added as resources in the module) and only rule the variables.less within the user project I have not had any success in finding a working setup.
Do you see any way to accomplish this setup ?

best regards
Peter Petersson

JS error does not result in build step failure

If there's an error such as JSC_TRAILING_COMMA I will see [error] in the log. But the js step itself will result in [success]. That can lead to confusing errors if later steps in a build chain depend on the output from the js step.

infinite recompilation of js-manifest

Hi!

There is small but annoying issue in sbt-js plugin. I have such settings:

(sourceDirectories in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile) {
  src =>
    Seq(
      src / "coffee",
      src / "javascript"
    )
},
(resourceManaged in (Compile, JsKeys.js)) <<= (target in Compile)(_ / "webapp" / "assets"),
(includeFilter in (Compile, JsKeys.js)) := "bundle.jsm",

I have only one file for compilation - bundle.jsm. But it always will be recompiled. As i understand the issue is that plugin doesn't store compiled dependencies. So graph think that bundle.jsm requires compilation, because its parents wasn't compiled(compiled files are absent).
My solution is to compile files and their dependencies into temporary folder, i.e. target/sbt-js/compiled. Then copy only files that are related to includes filter.
I didn't understand fully all internals of plugin, so my question is it possible? Can you fix it? Do you have another solutions for this?

I can help with fix, but i need to know really possible solution :)

Rename sbt-js to sbt-coffeescript

This should be done sooner than later, as the sbt-js subproject name is confusing and doesn't match the naming of the other sbt- subprojects (i.e. sbt-mustache and sbt-less, we don't call these subprojects sbt-html and sbt-css)

Doing the rename means we consistent naming scheme, i.e. if we want to add typescript the subproject name would be sbt-typescript

I would be willing to make a pull request to implement this if there are no qualms about this, note that it is obviously a breaking change should it happen ;). Note sure if we should do it for 0.6 or for a later revision

Bintray gone, builds no longer work

I know this is a bit of a blast from the past, but as Bintray has gone away I'm no longer able to build with this plugin.

Would it be possible to put it up on Maven Central for continued use? Thanks!

Don't know how to serve sbt-js files

I'm running into the same problem as this stack overflow user
http://stackoverflow.com/questions/27251121/how-to-serve-files-generated-by-sbt-js-using-spray-can

I have a problem that after using sbt-js to compile my JavaScript files, the compiled files are in resource_managed directory but the uncompiled files are still in the resource directory. When the app runs it will use the uncompiled files in the resource directory.

If I move the JavaScript files to a /src/main/js directory, the uncompiled files won't be included in the .jar package, but now I don't know how to access them. I'm using spray and creating custom routes for the JavaScript, but I'm loading and keeping the JavaScript in memory.
ex: scala.io.Source.fromURL(getClass.getResource("/js/app.js"))
Is there a better way to access the compiled js, preferably using one of the spray file and resource directives?

Thanks,
Jim

Trouble compiling bootstrap-sass

I have a strange error when I compile bootstrap-sass from https://github.com/twbs/bootstrap-sass. The error is:

java.io.FileNotFoundException: /project/app/assets/bootstrap/mixins (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:131)
at sbt.Using$$anonfun$fileReader$1.apply(Using.scala:86)
at sbt.Using$$anonfun$fileReader$1.apply(Using.scala:86)
at sbt.Using$$anon$2.openImpl(Using.scala:72)
at sbt.OpenFile$class.open(Using.scala:46)
at sbt.Using$$anon$2.open(Using.scala:70)
at sbt.Using$$anon$2.open(Using.scala:70)
at sbt.Using.apply(Using.scala:24)
at sbt.IO$.readLines(IO.scala:677)
at com.untyped.sbtsass.CssSource.parents$lzycompute(CssSource.scala:18)
at com.untyped.sbtsass.CssSource.parents(CssSource.scala:16)
at com.untyped.sbtgraph.Graph$class.parents(Graph.scala:172)
at com.untyped.sbtsass.Graph.parents(Graph.scala:6)
at com.untyped.sbtgraph.Graph$class.com$untyped$sbtgraph$Graph$$$plus$eq(Graph.scala:30)
at com.untyped.sbtgraph.Graph$$anonfun$com$untyped$sbtgraph$Graph$$$plus$eq$1.apply(Graph.scala:30)
at com.untyped.sbtgraph.Graph$$anonfun$com$untyped$sbtgraph$Graph$$$plus$eq$1.apply(Graph.scala:30)
at scala.collection.immutable.List.foreach(List.scala:318)
at com.untyped.sbtgraph.Graph$class.com$untyped$sbtgraph$Graph$$$plus$eq(Graph.scala:30)
at com.untyped.sbtgraph.Graph$class.$plus$eq(Graph.scala:22)
at com.untyped.sbtsass.Graph.$plus$eq(Graph.scala:6)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1$$anonfun$apply$6$$anonfun$apply$8.apply(Plugin.scala:86)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1$$anonfun$apply$6$$anonfun$apply$8.apply(Plugin.scala:86)
at scala.collection.immutable.List.foreach(List.scala:318)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1$$anonfun$apply$6.apply(Plugin.scala:86)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1$$anonfun$apply$6.apply(Plugin.scala:70)
at com.untyped.sbtsass.Plugin$.time(Plugin.scala:35)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1.apply(Plugin.scala:70)
at com.untyped.sbtsass.Plugin$$anonfun$sourceGraphTask$1.apply(Plugin.scala:69)
at scala.Function11$$anonfun$tupled$1.apply(Function11.scala:35)
at scala.Function11$$anonfun$tupled$1.apply(Function11.scala:34)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)

Unfortunately, I was unable to pin down the problem yet.

VariableRenamingPolicy.OFF makes no difference

Hi

If I use sbt-js and set the configuration (JsKeys.variableRenamingPolicy in Compile) := VariableRenamingPolicy.OFF it makes no difference. The variables are still renamed to shorter names.

However if I change the configuration as follows (JsKeys.compilationLevel in (Compile, JsKeys.js)) := CompilationLevel.WHITESPACE_ONLY the variable names are not shortened.

I'm using AngularJS which is picky about this. Plugin version 0.6.

compile and js command dependency conflicts with Other plugins

Dave,

based on the documentation (readme)
(compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile)
will cause the js task to run automatically when you run compile.

But when there are plugins (sbt-dustjs), this seems have conflicts.

in plugin.sbt, I have this:

addSbtPlugin("eu.getintheloop" %% "sbt-dustjs" % "0.0.4-SNAPSHOT")

addSbtPlugin("com.untyped" % "sbt-js" % "0.5")

in build.sbt, I use the the followings:

seq(dustSettings: _*)

seq(jsSettings : _*)

(resourceManaged in (Compile, DustKeys.dust)) <<= (sourceDirectory in Compile) ( _ / "resources" / "web" / "js"/"dust")

(compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile)

when type sbt compile

sbt compile

build.sbt:49: error: reference to compile is ambiguous;

it is imported twice in the same scope by
import root.dustjs.DustJsPlugin._
and import Keys._
(compile in Compile) <<= compile in Compile dependsOn (JsKeys.js in Compile)
^
[error] Type error in expression

you can find more details in
https://github.com/chesterxgchen/backbone-cellar/blob/master/spraydust

Better defaults for web frameworks

It would be useful to provide quick setup options for the popular web frameworks, probably implemented as separate sets of settings in each plugin.

For example, in a Lift project you might have a build.sbt that looks like this:

seq(jsSettingsForLift : _*)

and in Spray you might have:

seq(jsSettingsForSpray : _*)

See #42 for a more complete discussion of Lift.

Another idea: quick addition of vendor directories for JS/Less:

seq(jsSettingsForLift : _*)

seq(jsSettingsAddVendorDirectory("vendor") : _*)

Note: check sbt-bower, integrate with its defaults.

Publish for sbt 0.11.2

Hello, I was wondering if you were planning on publishing your plugins for sbt 0.11.2.

Closure Compiler support in minification mode only

Hi,

I wanted to confirm something before moving forward with an API proposal and hopefully a pull request very soon.

The problem

In Google Land, high upon the mountains, the laws of JavaScript dictate one should use adequate package management, with an a-la Java type provisioning system built with 2 compiler primitives, namely goog.require and goog.provide.

This is perhaps the most powerful feature the Closure Compiler has to offer, and to the best of my knowledge the sbt-js plugin is completely ignoring it by feeding in JavaScript sources to the compiler in parallel for minification only.

Conversely, using the Compiler directly in the "intended" way generally means, beyond the tedious annotations, working with a deps.js file, sub-modules that are auto-included, and a very advanced automated dependency generation and compilation system, dead code elimination, etc.

Without further ado, I would like to have:

In the following file: users/users-service.js

goog.provide('myapp.users.UserService');

/**
 * @constructor
 * @ngInject
 */
myapp.users.UserService = function($q, $http) {
  ..//etc
}
goog.addSingletonGetter(myapp.users.UserService);

And then in: users/users-controller.js

goog.provide('myapp.users.UserController');
goog.require('myapp.users.UserService');

Why would I go through all this trouble? Well, in an ideal world the compiler would then take care of every single .js output file and I would only include the single generated file, just like in the Java world all I need to worry about is a .jar.

Proposed solution

sbt-js should have a mode of feeding JS sources in the Google-esque way, where files are not individually compiled, but rather the entire output is fed to the compiler call in a single go via --input directives and a single output file(or one file per module) is being compiled and generated under a specified path.

For people who are committed to the Closure Compiler beyond simple minification, this seemingly simple change does introduce a new world of productivity, where you no longer need to include a thousand JS scripts in your header manually.

Is this something that's actively being considered or that you would happily merge as adjacent functionality?

Regards,

sbt-js: Produce source maps

Hey Dave! I'm taking a look at the sbt-js plugin to see if we can produce source maps for the compiled JS code. Have you put any thought/work into this? I'm taking the plunge, but I wanted to ask before I got too far along if you've already learned some things about this.

Unresolved dependencies

Got dependencies problem (see trace below).
Maybe related to xsbt-web-plugin? I think that here

3f61dbb

it should be 0.11.2-0.2.11 according to

https://github.com/siasia/xsbt-web-plugin/wiki

and not 0.11.2-0.2.10

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: untyped#sbt-runmode;0.1-SNAPSHOT: badly encoded module revision id: '+e:scalaVersion:#@#:+2.9.1:#@#:+revision:#@#:+0.2-SNAPSHOT:#@#:+module:#@#:+sbt-less:#@#:+e:sbtVersion:#@#:+0.11.2:#@#:+organisation:#@#:+untyped:#@#:+branch:#@#:+@#:NULL:#@:#@#: +e:scalaVersion:#@#:+2.9.1:#@#:+revision:#@#:+0.1-SNAPSHOT:#@#:+module:#@#:+sbt-js:#@#:+e:sbtVersion:#@#:+0.11.2:#@#:+organisation:#@#:+untyped:#@#:+branch:#@#:+@#:NULL:#@:#@#:': +e:scalaVersion doesn't start with +
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] untyped:sbt-runmode:0.1-SNAPSHOT (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn]
[error] {file:/Users/dfugazza/Projects/lift-mongo-app.g8/src/main/g8/project/}default-224d15/*:update: sbt.ResolveException: unresolved dependency: untyped#sbt-runmode;0.1-SNAPSHOT: badly encoded module revision id: '+e:scalaVersion:#@#:+2.9.1:#@#:+revision:#@#:+0.2-SNAPSHOT:#@#:+module:#@#:+sbt-less:#@#:+e:sbtVersion:#@#:+0.11.2:#@#:+organisation:#@#:+untyped:#@#:+branch:#@#:+@#:NULL:#@:#@#: +e:scalaVersion:#@#:+2.9.1:#@#:+revision:#@#:+0.1-SNAPSHOT:#@#:+module:#@#:+sbt-js:#@#:+e:sbtVersion:#@#:+0.11.2:#@#:+organisation:#@#:+untyped:#@#:+branch:#@#:+@#:NULL:#@:#@#:': +e:scalaVersion doesn't start with +

Wrong scope for JS output dir: resourceManaged

Before I start I want to make it clear that I'm near useless when it comes to SBT. I've read the doco, I don't really get it, I mostly get by by googling, copying, pasting and tweaking. That being said, if this is an error with me rather than sbt-js, I apologise.

What I'm trying to accomplish is sbt-js reading src/main/javascript/*.js and transforming them into <classpath>/js/*.js.

I've got it working with these settings:

// Put Javascript in WAR root
(webappResources in Compile) <+= (resourceManaged in Compile)

// Minify JS in src/main/javascript
(sourceDirectory in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)(_ / "javascript")

// Put minified JS in js/
(resourceManaged in (Compile,JsKeys.js)) <<= (resourceManaged in Compile)( _ / "js")

However the last line looks wrong to me. I think setting it that way will cause all managed resources to get a js/ prefix, which no one wants. If I change it to this:

// Put minified JS in js/
(resourceManaged in JsKeys.js) <<= (resourceManaged in Compile)( _ / "js")

it causes the minified JS to lose the js/ prefix again. May as well delete the line.

And that's what I think the bug here is. sbt-js should be relying on resourceManaged in JsKeys.js not resourceManaged in Compile, right?

The not really an issue, issue

Hello, do you have a mailing list, or IRC channel for these projects?

I essentially want to output my minimised files into a different location based on some build number or md5 hash for each file.

Cheers

Robbie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.