Import Less-Files from Classpath (Bootstrap Webjars)

I want to generate my CSS-Files from Less-Files via LessCss-Gradle-Plugin (https://github.com/obecker/gradle-lesscss-plugin).

In my build.gradle I added the webjar-dependencies for bootstrap and so on..

dependencies { implementation project(':pet-clinic-data') implementation 'org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.3.2.RELEASE' implementation 'org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE' implementation 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.12' implementation 'org.webjars:webjars-locator-core:0.45' implementation 'org.webjars:jquery:2.2.4' implementation 'org.webjars:jquery-ui:1.11.4' implementation 'org.webjars:bootstrap:3.3.6' runtimeOnly 'org.springframework.boot:spring-boot-devtools:2.3.2.RELEASE' testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE' compile group: 'org.springframework', name: 'spring-tx', version: '5.2.8.RELEASE' } 

And my lesscss-Task:

lesscss { source = fileTree('src/main/less') {     include '**/*.less'  } dest = "$buildDir/resources/main/static/resources/css"  dependencies {     compile 'org.webjars:bootstrap:3.3.6'     compileClasspath 'org.webjars:bootstrap:3.3.6' } } 

I have some less-Files that require Elements from classes in the bootstrap-webjar (for example: label-success). I have the webjar in my external dependencies, but how can I use the @Import-Statement to link to that? I tried something like:

@import "classpath: resources/webjars/bootstrap/3.3.6/less/bootstrap.less"; @import "classpath:META-   INF/resources/webjars/bootstrap/3.3.6/less/bootstrap.less" 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.