Giter Club home page Giter Club logo

sbt-less's Introduction

sbt-less

Build Status

Allows less to be used from within sbt. Builds on com.github.sbt:js-engine in order to execute the less compiler along with the scripts to verify. js-engine enables high performance linting given parallelism and native JS engine execution.

To use this plugin use the addSbtPlugin command within your project's plugins.sbt (or as a global setting) i.e.:

addSbtPlugin("com.github.sbt" % "sbt-less" % "2.0.0")

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:

lazy val root = (project in file(".")).enablePlugins(SbtWeb)

The compiler allows most of the same options to be specified as the lessc CLI itself. Here are the options:

Option Description
cleancss Compress output using clean-css.
cleancssOptions Pass an option to clean css, using CLI arguments from https://github.com/GoalSmashers/clean-css .
color Whether LESS output should be colorised
compress Compress output by removing some whitespaces.
globalVariables Variables that will be placed at the top of the less file.
ieCompat Do IE compatibility checks.
insecure Allow imports from insecure https hosts.
maxLineLen Maximum line length.
modifyVariables Modifies a variable already declared in the file.
optimization Set the parser's optimization level.
relativeImports Re-write import paths relative to the base less file. Default is true.
relativeUrls Re-write relative urls to the base less file.
rootpath Set rootpath for url rewriting in relative imports and urls.
silent Suppress output of error messages.
sourceMap Outputs a v3 sourcemap.
sourceMapFileInline Whether the source map should be embedded in the output file
sourceMapLessInline Whether to embed the less code in the source map
sourceMapRootpath Adds this path onto the sourcemap filename and less file paths.
strictImports Whether imports should be strict.
strictMath Requires brackets. This option may default to true and be removed in future.
strictUnits Whether all unit should be strict, or if mixed units are allowed.
urlArgs Adds params into url tokens (e.g. 42, cb=42 or 'a=1&b=2').
verbose Be verbose.

The following sbt code illustrates how compression can be enabled:

Assets / LessKeys.compress := true

By default only main.less is looked for given that the LESS compiler must be explicitly fed the files that are required for compilation. Beyond just main.less, you can use an expression in your build.sbt like the following:

Assets / LessKeys.less / includeFilter := "foo.less" | "bar.less"

...where both foo.less and bar.less will be considered for the LESS compiler.

Alternatively you may want a more general expression to exclude LESS files that are not considered targets for the compiler. Quite commonly, LESS files are divided up into those entry point files and other files, with the latter set intended for importing into the entry point files. These other files tend not to be suitable for the compiler in isolation as they can depend on the global declarations made by other non-imported LESS files. For example, you may have a convention where any LESS file starting with an _ should not be considered for direct compilation. To include all .less files but exclude any beginning with an _ you can use the following declaration:

Assets / LessKeys.less / includeFilter := "*.less"

Assets / LessKeys.less / excludeFilter := "_*.less"

sbt-less's People

Contributors

adamhooper avatar akosicki avatar asazernik avatar benmccann avatar blobson avatar chungonn avatar danielnixon avatar davidlawes avatar eecolor avatar gmethvin avatar huntc avatar irevive avatar jroper avatar jtjeferreira avatar micmro avatar mkurz avatar n4to4 avatar pvlugter avatar randak avatar richdougherty avatar scala-steward avatar tkawachi avatar warry avatar yatskevich 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

Watchers

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

sbt-less's Issues

Exception with empty LESS file

If I have an empty less file, Play Framewok will throw this exception:

Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may
be orders of magnitude slower than using node.js.
[info] LESS compiling on 1 source(s)
[error] TypeError: [object Object] is not a function, it is object. (/path/project/target/node-modules/webjars/less/lib/less/index.js#4)
  at /path/project/target/node-modules/webjars/less/lib/less/index.js:4
[error]     at /path/project/target/node-modules/webjars/less/lib/less-node/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /path/project/target/node-modules/webjars/less/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /path/project/target/less/sbt-less-1.1.0.jar:14
[error]     at /path/project/target/less/sbt-less-1.1.0.jar:3
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:497
[error]     at startup (trireme.js:142)
[error]     at trireme.js:923
[info]
[trace] Stack trace suppressed: run last web-assets:less for the full output.
[error] (web-assets:less) com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: TypeError: [object Object] is not a function, it is object. (/home/users/project/project
/project/target/node-modules/webjars/less/lib/less/index.js#4)    at /path/project/target/node-modules/webjars/less/lib/less/index.js:4
[error]     at /path/project/target/node-modules/webjars/less/lib/less-node/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /path/project/target/node-modules/webjars/less/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /path/project/target/less/sbt-less-1.1.0.jar:14
[error]     at /path/project/target/less/sbt-less-1.1.0.jar:3
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:497
[error]     at startup (trireme.js:142)
[error]     at trireme.js:923
[error] application -
! @6n7dim8ji - Internal server error, for (GET) [/] ->

play.sbt.PlayExceptions$UnexpectedException: Unexpected exception[JsTaskFailure: TypeError: [object Object] is not a function, it is object. (/home/users/projec
t/project/project/target/node-modules/webjars/less/lib/less/index.js#4)    at /path/project/target/node-modules/webjars/less/lib/less/inde
x.js:4
    at /path/project/target/node-modules/webjars/less/lib/less-node/index.js:1
    at module.js:456
    at module.js:474
    at module.js:356
    at module.js:312
    at module.js:364
    at require (module.js:380)
    at /path/project/target/node-modules/webjars/less/index.js:1
    at module.js:456
    at module.js:474
    at module.js:356
    at module.js:312
    at module.js:364
    at require (module.js:380)
    at /path/project/target/less/sbt-less-1.1.0.jar:14
    at /path/project/target/less/sbt-less-1.1.0.jar:3
    at module.js:456
    at module.js:474
    at module.js:356
    at module.js:312
    at module.js:497
    at startup (trireme.js:142)
    at trireme.js:923
]
        at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:51) ~[na:na]
        at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) ~[na:na]
        at scala.Option.map(Option.scala:145) ~[scala-library-2.11.6.jar:na]
        at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44) ~[na:na]
        at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40) ~[na:na]
        at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]
        at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17) ~[na:na]
        at scala.util.Either$LeftProjection.map(Either.scala:377) ~[scala-library-2.11.6.jar:na]
        at play.sbt.run.PlayReload$.compile(PlayReload.scala:17) ~[na:na]
        at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3$$anonfun$2.apply(PlayRun.scala:60) ~[na:na]
Caused by: com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: TypeError: [object Object] is not a function, it is object. (/path/project/target
/node-modules/webjars/less/lib/less/index.js#4)    at /path/project/target/node-modules/webjars/less/lib/less/index.js:4
    at /path/project/target/node-modules/webjars/less/lib/less-node/index.js:1
    at module.js:456
    at module.js:474
    at module.js:356
    at module.js:312
    at module.js:364
    at require (module.js:380)
    at /path/project/target/node-modules/webjars/less/index.js:1
    at module.js:456
    at module.js:474
    at module.js:356
    at module.js:312
    at module.js:364
    at require (module.js:380)
    at /path/project/target/less/sbt-less-1.1.0.jar:14
   at /path/project/target/less/sbt-less-1.1.0.jar:3
   at module.js:456
   at module.js:474
   at module.js:356
   at module.js:312
   at module.js:497
   at startup (trireme.js:142)
   at trireme.js:923

       at com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:195) ~[na:na]
       at com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:167) ~[na:na]
       at scala.util.Success$$anonfun$map$1.apply(Try.scala:206) ~[scala-library-2.11.6.jar:na]
       at scala.util.Try$.apply(Try.scala:161) ~[scala-library-2.11.6.jar:na]
       at scala.util.Success.map(Try.scala:206) ~[scala-library-2.11.6.jar:na]
       at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) ~[scala-library-2.11.6.jar:na]
       at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) ~[scala-library-2.11.6.jar:na]
       at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) ~[scala-library-2.11.6.jar:na]
       at scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107) ~[scala-library-2.11.6.jar:na]
       at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library-2.11.6.jar:na]

If I remove the file - everything works

LESS compilation fails with exception

SBT-LESS plugin works fine in my 3 Linux environments but fails at my colleague's computer. He uses:

  • latest Windows 7, 64 bit
  • java -version says Java 1.8.0_45
  • sbt --version says 0.13.5
  • sbt-less 1.1.0, Rhino version

There is minimal project to reproduce the issue. It fails during LESS compilation. However, it works fine in all my 3 Linuxes so it might not be that easy to reproduce it.

Do you have any hunch what causes the issue?

The exception stack trace is here:

No source available, here is the exception stack trace:
->com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: TypeError: [object Object] is not a function, it is object. (D:\Git\idea\matahari\project\target\node-modules\webjars\less\lib\less\index.js#4) at D:\Git\idea\matahari\project\target\node-modules\webjars\less\lib\less\index.js:4 (anonymous)
 at D:\Git\idea\matahari\project\target\node-modules\webjars\less\lib\less-node\index.js:1 (anonymous)
 at module.js:456 (anonymous)
 at module.js:474 (anonymous)
 at module.js:356 (anonymous)
 at module.js:312 (anonymous)
 at module.js:364 (anonymous)
 at module.js:380 (require)
 at D:\Git\idea\matahari\project\target\node-modules\webjars\less\index.js:1 (anonymous)
 at module.js:456 (anonymous)
 at module.js:474 (anonymous)
 at module.js:356 (anonymous)
 at module.js:312 (anonymous)
 at module.js:364 (anonymous)
 at module.js:380 (require)
 at D:\Git\idea\matahari\project\target\less\sbt-less-1.1.0.jar:14 (anonymous)
 at D:\Git\idea\matahari\project\target\less\sbt-less-1.1.0.jar:3 (anonymous)
 at module.js:456 (anonymous)
 at module.js:474 (anonymous)
 at module.js:356 (anonymous)
 at module.js:312 (anonymous)
 at module.js:497 (anonymous)
 at trireme.js:142 (startup)
 at trireme.js:923 (anonymous)
     com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:195)
     com.typesafe.sbt.jse.SbtJsTask$$anonfun$com$typesafe$sbt$jse$SbtJsTask$$executeJsOnEngine$1.apply(SbtJsTask.scala:167)
     scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
     scala.util.Try$.apply(Try.scala:161)
     scala.util.Success.map(Try.scala:206)
     scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
     scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
     scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
     scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107)
     scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
     scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
     scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
     scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Excluding an assets subdirectory

Is it possible to exclude a directory using the exclude filter? After looking at the sbt docs I can't figure out how you would do this.

I apologize if a github issues isn't the right place for this. Thanks

Minify is not happening without the the compression option

Hi,

I am able to turn on/off the minify feature by adjusting the following option as you stated in the document.
LessKeys.compress in Assets := true

However, I found that it does not give me both the un-minified and minified file at the same time. This means, I would have to adjust this feature before I build for production. I don't think it is convenient.

Could you please suggest the best way to utilize the plugin?

Thanks.
Jerry

ERR_INVALID_ARG_TYPE when running less task

Hi!
I ran into an issue with sbt-less resulting in the following build error

[info] LESS compiling on 1 source(s)
[error] internal/fs/utils.js:701
[error]     throw new ERR_INVALID_ARG_TYPE(
[error]     ^
[error] 
[error] TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
[error]     at Object.writeFile (fs.js:1385:5)
[error]     at /Users/landlockedsurfer/src/trash/sbt-less-example/project/target/less/lessc.js:89:20
[error]     at /Users/landlockedsurfer/src/trash/sbt-less-example/project/target/node-modules/webjars/mkdirp/index.js:47:26
[error]     at FSReqCallback.oncomplete (fs.js:177:5) {
[error]   code: 'ERR_INVALID_ARG_TYPE'
[error] }
...

The build error popped up yesterday all of a sudden (most likely due to a refresh of a node dependency).
After creating a standalone project I noticed that that issue seems to be related to files that are starting with the definition of a less variable.
I could not track down the cause of the problem but found a workaround by adding some additional lines at the top of the file.
E.g.
This file causes a build error

// /* add multiline comment to make things work, i.e. remove double slash at the start of this line */
// The problem seems to occur whenever the file starts with a variable declaration
@white: #fff;

By enabling the multiline comment at the start the less task runs fine again.

/* add multiline comment to make things work, i.e. remove double slash at the start of this line */
// The problem seems to occur whenever the file starts with a variable declaration
@white: #fff;

I've created a sample project to demonstrate the issue here: https://github.com/landlockedsurfer/sbt-less-test

Posting this workaround here in case someone else stumbles across this issue since I could not find anything in the internets.

Bug causing slow SBT start-up

In a clean play-scala-starter-example project (https://github.com/playframework/play-scala-starter-example):

  1. Change build.properties to use sbt 0.13.17.
  2. Add file debug.sbt containing logLevel := Level.Debug to the project directory to enable debugging output from SBT.
  3. Add addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2") to plugins.sbt
  4. Run rm -r project/project/ target project/target to get rid of all compiled artifacts
  5. Run sbt | grep ERROR and you see four errors such as CLIENT ERROR: Not Found url=https://repo.typesafe.com/typesafe/ivy-releases/org.webjars.npm/strip-json-comments/
  6. Add addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.6") to plugins.sbt
  7. Remove the compile artifacts again and rerun sbt | grep ERROR. It reports 112 such errors.

Time to launch sbt goes up from 11 seconds to 52 seconds on my recent high-end MacBook Pro when sbt-less and sbt-jshint are included as plugins.

Cannot resolve dependencies: com.typesafe#jse_2.10;1.0.0, com.typesafe#npm_2.10;1.0.0

Add addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0") to plugins.sbt. Run sbt. Dependencies for jse and npm can't be resolved:

[info] Resolving com.typesafe#jse_2.10;1.0.0 ...
[warn] module not found: com.typesafe#jse_2.10;1.0.0
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe/jse_2.10/1.0.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe/jse_2.10/1.0.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/tvaroh/.ivy2/local/com.typesafe/jse_2.10/1.0.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/typesafe/jse_2.10/1.0.0/jse_2.10-1.0.0.pom
[info] Resolving com.typesafe#npm_2.10;1.0.0 ...
[warn] module not found: com.typesafe#npm_2.10;1.0.0
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe/npm_2.10/1.0.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe/npm_2.10/1.0.0/ivys/ivy.xml
[warn] ==== local: tried
[warn] /Users/tvaroh/.ivy2/local/com.typesafe/npm_2.10/1.0.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/typesafe/npm_2.10/1.0.0/npm_2.10-1.0.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe#jse_2.10;1.0.0: not found
[warn] :: com.typesafe#npm_2.10;1.0.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.typesafe#jse_2.10;1.0.0: not found
unresolved dependency: com.typesafe#npm_2.10;1.0.0: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:125)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:103)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:48)
at sbt.IvySbt$$anon$3.call(Ivy.scala:57)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:57)
at sbt.IvySbt.withIvy(Ivy.scala:98)
at sbt.IvySbt.withIvy(Ivy.scala:94)
at sbt.IvySbt$Module.withModule(Ivy.scala:115)
at sbt.IvyActions$.update(IvyActions.scala:125)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1223)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1221)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1244)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1242)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1246)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1241)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1249)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1214)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1192)
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:745)
error sbt.ResolveException: unresolved dependency: com.typesafe#jse_2.10;1.0.0: not found
[error] unresolved dependency: com.typesafe#npm_2.10;1.0.0: not found

support for npm webjars

I have following lines in build.sbt:

libraryDependencies += "org.webjars.npm" % "github-com-josdejong-jsoneditor" % "5.5.10"

libraryDependencies += "org.webjars" % "bootstrap" % "3.0.2"

and main.less as

@import "lib/github-com-josdejong-jsoneditor/soneditor.css";
@import "lib/bootstrap/less/bootstrap.less";

During LESS compilation content of second @import is successfully included in resulting main.css while first remains as declared

TypeError: [object Object] is not a function, it is object

I have two environments: Windows 7 and GNU/Linux Debian Wheezy
I'm using Play Framework with sbt-less library.

On Windows machine my .less file compiles and runs just fine.
On Linux machine if I don't have pure Node.js installed and I'm using Trireme, I get this exception:

[info] LESS compiling on 1 source(s)
[error] TypeError: [object Object] is not a function, it is object. (/home/users/project/project/project/target/node-modules/webjars/less/lib/less/index.js#4)    at /home/users/project/project/pr
oject/target/node-modules/webjars/less/lib/less/index.js:4
[error]     at /home/users/project/project/project/target/node-modules/webjars/less/lib/less-node/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /home/users/project/project/project/target/node-modules/webjars/less/index.js:1
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:364
[error]     at require (module.js:380)
[error]     at /home/users/project/project/project/target/less/sbt-less-1.1.0.jar:14
[error]     at /home/users/project/project/project/target/less/sbt-less-1.1.0.jar:3
[error]     at module.js:456
[error]     at module.js:474
[error]     at module.js:356
[error]     at module.js:312
[error]     at module.js:497
[error]     at startup (trireme.js:142)
[error]     at trireme.js:923

With Node.js error is slightly different:

[info] LESS compiling on 1 source(s)
[error]
[error] /home/users/project/project/project/target/node-modules/webjars/less/lib/less/index.js:13
[error]         functions: require('./functions')(environment),
[error]                                          ^
[error] TypeError: object is not a function
[error]     at module.exports (/home/users/project/project/project/target/node-modules/webjars/less/lib/less/index.js:13:42)
[error]     at Object.<anonymous> (/home/users/project/project/project/target/node-modules/webjars/less/lib/less-node/index.js:5:12)
[error]     at Module._compile (module.js:456:26)
[error]     at Object.Module._extensions..js (module.js:474:10)
[error]     at Module.load (module.js:356:32)
[error]     at Function.Module._load (module.js:312:12)
[error]     at Module.require (module.js:364:17)
[error]     at require (module.js:380:17)
[error]     at Object.<anonymous> (/home/users/project/project/project/target/node-modules/webjars/less/index.js:1:80)
[error]     at Module._compile (module.js:456:26)

Could you please fix that?
Thank you in advance

failing to compile LESS files when migrating from play-2.2 to play-2.3

hi guys, we're running into the following exception when trying to compile LESS files in our project:

[info] LESS compiling on 69 source(s)
spray.json.DeserializationException: Expected Int as JsNumber, but got null
    at spray.json.package$.deserializationError(package.scala:23)
    at spray.json.BasicFormats$IntJsonFormat$.read(BasicFormats.scala:29)
    at spray.json.BasicFormats$IntJsonFormat$.read(BasicFormats.scala:25)
    at spray.json.JsValue.convertTo(JsValue.scala:32)

All LESS sources seem to be fine, building successfully with Play-2.2. default and external LESS 1.7 (via https://github.com/jmparsons/play-lessc) compiler. Could you please point to the right direction how to fix this?

I've attached an sbt project with the files if you could have a look (customized file filter is used). I've been moving LESS files in and out but it didn't help.

I also try to enable verbosity (LessKeys.verbose) to see which files fail but it won't show per file compilation progress ? Does the plugin pick this option?

thanks in advance!

Doesn't work with play > 2.5.4

After compilation:
[error] - application - [404] Client error on /assets/stylesheets/main.css: Resource not found by Assets controller

Please tell what info is needed that I can provide to debug this.

Empty less file causes Unexpected exception

It was nearly impossible for me to know why and what to do from this error after making lots of changes at the same time to migrate to new version of play. Who would have thought this error has anything to do with empty less file.

play.PlayExceptions$UnexpectedException: Unexpected exception[DeserializationException: Expected Int as JsNumber, but got null]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:236) ~[na:na]
    at play.PlayReloader$$anon$1$$anonfun$play$PlayReloader$$anon$$taskFailureHandler$1.apply(PlayReloader.scala:229) ~[na:na]
    at scala.Option.map(Option.scala:145) ~[scala-library-2.11.1.jar:na]
    at play.PlayReloader$$anon$1.play$PlayReloader$$anon$$taskFailureHandler(PlayReloader.scala:229) ~[na:na]
    at play.PlayReloader$$anon$1$$anonfun$reload$2.apply(PlayReloader.scala:89) ~[na:na]
Caused by: spray.json.DeserializationException: Expected Int as JsNumber, but got null
    at spray.json.package$.deserializationError(package.scala:23) ~[na:na]
    at spray.json.BasicFormats$IntJsonFormat$.read(BasicFormats.scala:29) ~[na:na]
    at spray.json.BasicFormats$IntJsonFormat$.read(BasicFormats.scala:25) ~[na:na]
    at spray.json.JsValue.convertTo(JsValue.scala:32) ~[na:na]
    at com.typesafe.sbt.jse.SbtJsTask$JsTaskProtocol$LineBasedProblemFormat$$anonfun$read$7.apply(SbtJsTask.scala:117) ~[na:na]

Documentation is outdated

README.md is outdated, in 1.0.0-M1 build.sbt should contain:

import com.typesafe.jse.sbt.JsEnginePlugin
import com.typesafe.web.sbt.WebPlugin
import com.typesafe.less.sbt.LessPlugin

WebPlugin.webSettings

JsEnginePlugin.jsEngineSettings

LessPlugin.lessSettings

Less features unavailable

Hi,

First of all thank you for another great plugin!

I copy pasted from the examples here, but they will not compile in sbt-less. This is likely because the version of the less-compiler in the webjar release is pre-1.7.0.

Are there any plans for a future release to fix this?

Regards,
Flavian

Compile Less files in a module

Hello,

Thank you for this library. I am trying to use in a module that has a playframework 2.3.8. Is it possible? The module is compiling, but seems that is not able to see the less files.

In other projects less files seems are compiling when I hit the url of the project. But because this is a module, not a project, seems is not working.

Thank you

Triggered off "play run" but not "play compile"

It seems that sbt-less is triggered when you do "play run" and the web server receives a request. That's strange to me. Why do the compilation lazily instead of making it dependent upon play compile?

java.lang.IllegalArgumentException: runOps function returned results for unknown ops

Less compiler is emitting errors when a sub project has a less file. This can be reproduce using 'show web-assets:assets'. Below is the complete error message

[trace] Stack trace suppressed: run last elementum/web-assets:less for the full output.
error java.lang.IllegalArgumentException: runOps function returned results for unknown ops: Set(/home/chungonn/development/scala-projects/elementum/app/assets/stylesheets/elementum.less)
[error] Total time: 70 s, completed Jul 1, 2014 10:17:51 AM
[sojourner3] $ last elementum/web-assets:less
java.lang.IllegalArgumentException: runOps function returned results for unknown ops: Set(/home/chungonn/development/scala-projects/elementum/app/assets/stylesheets/elementum.less)
at com.typesafe.sbt.web.incremental.package$.syncIncremental(package.scala:235)
at com.typesafe.sbt.jse.SbtJsTask$$anonfun$jsSourceFileTask$1.apply(SbtJsTask.scala:271)
at com.typesafe.sbt.jse.SbtJsTask$$anonfun$jsSourceFileTask$1.apply(SbtJsTask.scala:257)
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:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
error java.lang.IllegalArgumentException: runOps function returned results for unknown ops: Set(/home/chungonn/development/scala-projects/elementum/app/assets/stylesheets/elementum.less)

Using sbt-less

I am confused about the information provided by the sbt-less readme

When i create a new Simple Play Scala Application with activator, build.sbt contains this line:
lazy val root = (project in file(".")).enablePlugins(PlayScala)

In the readme of sbt-less it says that i should use this line:
lazy val root = (project in file(".")).enablePlugins(SbtWeb)

It does work with 'lazy val root = (project in file(".")).enablePlugins(PlayScala)', so should the readme be updated or the two statements merged or..?

Less compilation with node is stuck

We have a project with a large number of .less files compiled with sbt-less 1.1.1. The less compilation using node or Trireme worked quite well for a while. One of the reason why the number of .less files is that high is that we have organized the less files in a structure with multiple themes which we all want to compile during a deployment.

Since we recently added new .less files with new themes we are now stuck with the less compilation. The node processes don't terminate. Testing on my machine (Mid 2015 MacBook Pro) the less compilation forks 9 node processes, each of them running with high CPU load for about 10 seconds. Then the node processes go down to 0% CPU and then are stuck forever. The less compilation does not terminate.

I have a sample Play project where this can be reproduced. I currently don't want to share it publicly, but I'm happy to add members to the private Github repo if someone wants to reproduce the issue.

If we remove the number of less files then the issue disappears again.
I also noticed that if I set JsEngineKeys.parallelism := 20 then the less compilation works again and all node processes terminate after less then 10 seconds. The compilation time itself doesn't seem to be the issue.

My suspicion is that the amount of files per node process... or maybe the length of the arguments passed to the node process makes the difference. I checked whether there are any limitations on process.argv in node.js, but couldn't find any hint or documentation.

LessKeys.cleancss w/o node.js blows up

It seems like this plugin should include clean-css when we prefer to use the JDK's JS engine.

JsTaskFailure: Error: Cannot find module 'clean-css' (/Users/Apigee/src/noderunner/node10/node10src/src/main/javascript/io/apigee/trireme/node10/node/module.js#340) at /Users/Apigee/src/noderunner/node10/node10src/src/main/javascript/io/apigee/trireme/node10/node/module.js:340 (anonymous)
    at /Users/Apigee/src/noderunner/node10/node10src/src/main/javascript/io/apigee/trireme/node10/node/module.js:280 (anonymous)
    at /Users/Apigee/src/noderunner/node10/node10src/src/main/javascript/io/apigee/trireme/node10/node/module.js:380 (require)

goes on quite a ways then starts walking project path.

Compatibility issue with sbt-js-engine Tireme/Rhino (Play 2.6)

There is a compatibility issue with sbt-js-engine versions for Play 2.6 that results in errors for the less compilation. See sbt/sbt-js-engine#56.

The build works fine with JsEngine Node but fails for Tireme / Rhino with the following error:

[info] LESS compiling on 1 source(s)
[error] java.lang.NoSuchMethodError: org.mozilla.javascript.ScriptRuntime.setObjectProp(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;Lorg/mozilla/javascript/Context;Lorg/mozilla/javascript/Scriptable;)Ljava/lang/Object;
[error]         at io.apigee.trireme.node10.main.trireme._c_anonymous_1(trireme.js:37)
[error]         at io.apigee.trireme.node10.main.trireme.call(trireme.js)
[error]         at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
[error]         at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3102)
[error]         at io.apigee.trireme.node10.main.trireme.call(trireme.js)
[error]         at io.apigee.trireme.core.internal.ScriptRunner.runScript(ScriptRunner.java:762)
[error]         at io.apigee.trireme.core.internal.ScriptRunner$4.run(ScriptRunner.java:702)
[error]         at org.mozilla.javascript.Context.call(Context.java:488)
[error]         at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)
[error]         at io.apigee.trireme.core.internal.ScriptRunner.call(ScriptRunner.java:697)
[error]         at io.apigee.trireme.core.ScriptFuture.run(ScriptFuture.java:183)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)

Upgrading sbt-js-engine might resolve this.

Cannot resolve dependencies: com.typesafe#jse_2.10;1.0.0, com.typesafe#npm_2.10;1.0.0 (Again)

I thought I'd open a new issue rather than add onto #31, but the dependencies above cannot be resolved now as it seems the artefacts no longer exist.

I have added the typesafe releases resolver to the resolvers as suggested in the original issue, but checking the repo itself shows the only content of the com.typesafe directory is

play-plugins-dust/
play-plugins-logger/
play-plugins-sbtgoodies/

Have these moved somewhere else now?

Cheers,

RC

Relative path handling in less webjars.

Bootstrap uses @icon-font-path less variable to specify path to fonts files, by default it is

 @icon-font-path:          "../fonts/";

When I'm importing bootstrap into my less file "theme.less" using

@import "less/bootstrap.less";

and then compile it, obviously path become resolved against my file "theme.less" location. As result fonts failed to load.

Solution is to override @icon-font-path in the "theme.less":

@icon-font-path:          "/webjars/bootstrap/3.1.1/fonts/";

but it is a little bit hacky.

How do I remove the less files from the final assets jar?

If I inspect the final assets jar, I have the original less files too
jar tf main.main-0.1-assets.jar

public/
public/js/
public/stylesheets/
public/js/9e25e7b342e2a2414b495ef8054baa9e-bundle.js
public/js/bundle.js.md5
public/stylesheets/a27d44187faf82b8e0ce88e94bec5a3d-main.css
public/stylesheets/main.less.md5
public/stylesheets/main.css.md5
public/stylesheets/main.css
public/stylesheets/main.css.map.md5
public/js/9e25e7b342e2a2414b495ef8054baa9e-bundle.js.gz
public/js/0e217aa37b96aeeab3cc11863bc407de-index.jsx
public/stylesheets/main.less
public/stylesheets/a86e1b70def244e457687d04f2d32414-main.less
public/stylesheets/main.css.gz
public/stylesheets/a27d44187faf82b8e0ce88e94bec5a3d-main.css.gz
public/js/bundle.js
public/js/index.jsx
public/js/index.jsx.md5
public/stylesheets/e182161c2c72307b368a26dda51985d5-main.css.map
public/js/bundle.js.gz
public/stylesheets/main.css.map

Any way of telling sbt to drop the original sources once they have been used in a resourceGenerator like sbt-less?

Filenames passed to lessc.js not properly escaped on Windows

I'm using Play 2.3 M1 on Windows and I'm getting the following error for my .less-file:

JsTaskFailure: 
undefined:1
[[C:\\git\\dmpster\\app\\assets\\stylesheets\\styles.less,stylesheets\\styles.
  ^
SyntaxError: Unexpected token C
    at Object.parse (native)
    at C:\git\dmpster\project\target\less\lessc.js:17:35
    at Object.<anonymous> (C:\git\dmpster\project\target\less\lessc.js:127:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

I believe the issue is that the path is not put in quotes, so the colon of C:\ is interpreted by the JSON parser.
(The error also happens with the Trireme parser, but only Node gives a proper callstack)

better error reporting

Current less errors are usually useless. I get something like

JsTaskFailure: [object Object] (/home/antonkulaga/denigma/semantic-web/project/target/node-modules/webjars/less/lib/less/parser.js#593) at /home/antonkulaga/denigma/semantic-web/project/target/node-modules/webjars/less/lib/less/parser.js:593 (anonymous)
    at /home/antonkulaga/denigma/semantic-web/project/target/less/sbt-less-1.0.0.jar:77 (anonymous)
...
and so on and so force

for each small mistake I have made in one of my less files, I am even not told in which file mistake occured. it does not help me solving the problem. I would like to see a name of the file that is broken with lines of the code that lead to parser failure instead.

Support of symbolic link ?

Hi,

As mentioned in #30 by pvlugter, sbt-less does not support modules through symbolic link.

In my case, I have a file structure like this :

-> Main Project
 -> app
 -> conf
 -> public
 -> modules
   -> Module1
    -> ...
   -> Module2 (sym link)
    -> app/assets/stylesheets
    -> ...
 -> project
  -> Build.scala

Module2 is a specific module for a specific client and depends on Module1. Module2 must be stored outside of the main project tree, that's why I use a symbolic link.

I'm facing this error when starting the main project :

java.lang.IllegalArgumentException: runOps function returned results for unknown ops: Set(/.../Module2/app/assets/stylesheets/main.less)
    at com.typesafe.sbt.web.incremental.package$.syncIncremental(package.scala:235)
    at com.typesafe.sbt.jse.SbtJsTask$$anonfun$jsSourceFileTask$1.apply(SbtJsTask.scala:271)
    at com.typesafe.sbt.jse.SbtJsTask$$anonfun$jsSourceFileTask$1.apply(SbtJsTask.scala:257)
    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:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

I have tried with no success to use sbt RootProject, I don't think it is possible in my structure.

I'm using sbt-web 1.1.1 and sbt-less 1.0.4.

Any plan to support symoblic link in a future release ?

source maps should use relative paths to resources included from webjars

When running play-2.3-highlights activator project in development mode, links to Bootstrap less files visible in Chrome developer tools Styles panel cannot be followed.

For example, when navigating do definition of btn class, the following link is used:
http://localhost:9000/home/.../play-2.3-highlights/target/web/web-modules/main/webjars/lib/bootstrap/less/buttons.less which obviously yields a 404 status. This is because http://localhost:9000/assets/stylesheets/main.css.map contains the following path for buttons.less: /home/.../play-2.3-highlights/target/web/web-modules/main/webjars/lib/bootstrap/less/buttons.less - an absolute local file system path.

The file is available at http://localhost:9000/assets/lib/bootstrap/less/buttons.less and my guess is that if a path relative to location of main.css would have been used in the source map, ie. lib/bootstrap/less/alerts.less the browser would be able to load it successfully.

The extra processing step for the source map, striping common prefix from file paths paths should be pretty straightforward to implement.

com.typesafe.sbt#sbt-less;1.1.1: not found

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.1")

I can't install the plugin. I tried a bunch of different version but all leads to the error.

Am I missing something ?

Version 2.6.2 of play doesn't compile .less files to .css files

I've asked a question on SO . In short, I have followed your documentation steps and my target folder doesn't seem to be converting .less files into .css files. So my stylesheet tags don't seem to be working at all. Is there something I'm missing ? I'm using scala version 2.12.2.

LessKeys ignored

Hi,

I'm running playframework 2.3.4., sbt-less 1.0.3

In my build.sbt file, I am setting the following:

LessKeys.compress in Assets := true

LessKeys.sourceMap in Assets := true

LessKeys.sourceMapFileInline in Assets := true

LessKeys.sourceMapLessInline in Assets := true

LessKeys.sourceMapRootpath in Assets := "../../"

Only the first line is being executed. the css is minified.
the next four appear to be ignored.

no map or less is inlined, and the sourceMapRootpath is not added to the .less urls.

Is anyone else having this trouble? Any solutions?

Thanks,
Colin

add lookup path

Hi guys,

thanks for this plugin. Is there a way to add a lookup path? For instance, I got the following app structure:

- assets
  - stylesheets
    - main.less
    - import.less
  - bower
    - bootstrap
      - less
        - bootstrap.less

The import of import.less works fine, but I fail at importing the bootstrap.less. Ideally, I would like to import it with @import 'bootstrap/less/bootstrap.less';, compared to using a relative path to main.less. Is this possible?

Thanks!

File compilation when included file change

In our application, we have few (usually 2 or 3) main LESS files producing CSS for web pages. All other files (many) are included into one or more of these main files through include statement. However, when we update any of these helpers, main files are not automatically recompiled. It requires to manually change them every time we want them to be up-to-date. This is very inconvenient especially when we are fixing/updating web page design.

Is there any way how to automatically recompile this main files (defined in includeFilter) when their dependencies change?

For easier testing there is very simple application with one main file and one included file.

Create .min.css automatically alongside .css.

Would it be more efficient to just duplicate lines 77-96 with compress:true and compress:false of lessc.js, put in another fs.writeFile and then remove LessKeys.compress? This would allow view code to be ported over from Play 2.2 very easily.

Default usage in pipeline?

Hi, I'm using SbtWeb with uglify, cssCompress and gzip.

For some reason it seems sbt-less is automatically entering the pipeline without me explicitly using it in

pipelineStages := Seq(uglify, cssCompress, gzip)

Is there a reason why sbt-less bypass the pipelineStages guideline for sbt-web?

Dependent compilation is broken since v 1.1.0, worked fine in 1.0.1

Let's assume the following scenario:

main.less with the following content:

@import (less) "file1.less"
@import (less) "file2.less"
..

In sbt-less 1.0.1, a change in any of the dependencies would trigger a full recompilation of main.less which is the correct behaviour, given most apps only include one end file. Can this behaviour be restored?

Option to disable generation of source maps

I like the option that sbt-rjs has to disable source maps. I very much want to avoid shipping these to production

I'd also like to avoid shipping the raw .less files to production. Should that be controlled by the same flag or a separate flag?

clean-css module

I was trying the plugin and I got this message after enabling cleancss

com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: Error: Cannot find module 'clean-css' (/Users/Apigee/src/noderunner/target/checkout/node10/node10src/src/main/javascript/io/apigee/trireme/node10/node/module.js#340)

Error reporting is not very useful

Error propagation from the Less compiler seems to be unfortunately on the TODO list, at least in version 1.0.1.

[error] 
[error] /Users/flavian/projects/s/s/project/target/node-modules/webjars/less/lib/less/parser.js:604
[error]                         throw new(LessError)(e, env);
[error]                               ^
[error] Error
[error]     at new Parser (/Users/flavian/projects/s/s/project/target/node-modules/webjars/less/lib/less/parser.js:333:27)
[error]     at /Users/flavian/projects/s/s/project/target/less/sbt-less-1.0.1.jar:57:26
[error]     at fs.js:334:14
[error]     at FSReqWrap.oncomplete (fs.js:95:15)
[info] 
[trace] Stack trace suppressed: run last api/web-assets:less for the full output.
[error] (api/web-assets:less) com.typesafe.sbt.jse.SbtJsTask$JsTaskFailure: 
[error] /Users/flavian/projects/s/s/project/target/node-modules/webjars/less/lib/less/parser.js:604
[error]                         throw new(LessError)(e, env);
[error]                               ^
[error] Error
[error]     at new Parser (/Users/flavian/projects/s/s/project/target/node-modules/webjars/less/lib/less/parser.js:333:27)
[error]     at /Users/flavian/projects/s/s/project/target/less/sbt-less-1.0.1.jar:57:26
[error]     at fs.js:334:14
[error]     at FSReqWrap.oncomplete (fs.js:95:15)

Even the full phase error display is just as useless, when triggered by: last api/web-assets:less. It would make sense to propagate the actual list of compiler errors to the SBT console and display all the errors as they are, as right now I have absolutely no idea what is going wrong and other than a lot of guess work not much can be done with the plugin itself.

Are there any existing plans to fix this?

Update resolvers in README example

The README has:

resolvers ++= Seq(
    Resolver.url("sbt snapshot plugins", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns),
    Resolver.sonatypeRepo("snapshots"),
    "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/",
    "Spray Releases" at "http://repo.spray.io/"
    )

I think that those are just an example from your build file, but it's kind of confusing as to whether any of them are needed. It might be clearer only to list the ones necessary for this plugin if any.

configuring the compile path

Hello,
I'm using play framework with this plugin. I have the following structure for public folder;

├───app
│   ├───css
│   ├───img
│   ├───js
│   │   ├───apis
│   │   ├───config
│   │   ├───controllers
│   │   ├───directives
│   │   ├───filters
│   │   ├───locale
│   │   └───services
│   └───views
└───test

In build.sbt, I have the following;

includeFilter in (Assets, LessKeys.less) := "*.less"

excludeFilter in (Assets, LessKeys.less) := "_*.less"

LessKeys.rootpath in Assets := "public/app/css"

In my main.scala.html, I have the following link tag;

<link rel="stylesheet" href='@routes.Assets.at("app/css/main.css")'>

And lastly, my routes has the following;

GET      /assets/*file             controllers.Assets.at(path="/public", file)

However, less configuration in build.sbt doesn't seem to work. I want to compile public/app/css/main.less. How can I achieve this ?

Support for LESS 1.7.3

It looks like this repository is using an old version of LESS Node running 1.6. My LESS stylesheets use features added in 1.7, and I was wondering if this is being updated.

Error when run ~ copy-resources

[trace] Stack trace suppressed: run last web-assets:copyResources for the full output.
[error] (web-assets:copyResources) java.io.FileNotFoundException: <project_path>/target/public (Is a directory)
[error] Total time: 0 s, completed 15.03.2014 20:50:41

Runtime issue

Was able to constantly reproduce the behaviour but not able to sample any log.

For the project we are working on we have around 150+ less (35 _.less, the rest is __.less)files, I will always see the less compliation hangs when a certain number of the less are being working on. The hanging will went away if I reduce a certain number of the less files. However, the interesting thing is that, this only apply to Windows JDK8 + node. If I use JDK7 + default js-engine. The hanging went away regardless the number of less files.

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.