Tailwind plugin class not found by #apply in app.scss - sass

I'm working on a SvelteKit project; I've installed Tailwind and its DaisyUI plugin.
Using #apply input (a class from DaisyUI) in app.scss got me the following error:
The 'input' class does not exist. If 'input' is a custom class, make sure it is defined within a '#layer' directive.
Any solutions? Thanks!

You can #apply to base TW classes only.
You can extend the classes in tailwind.config.js or create #layer components (or utilities...) inside .css

Related

Overriding module class in prestashop 1.7.6

I'm trying to override a class from a module I installed. The class is located in the modules folder in MyModule/lib/MyClass.php
So what i did is create a copy of that class in override/modules/MyModule/lib/MyClass.php and it's declared like this:
class MyClassOverride extends MyClass {
// custom code
}
I also deleted the class_index.php file.
And my changes are not applied so i really don't know what I am missing here. Is it even possible to do that ? I heard that in previous versions of prestashop you couldn't override a module class...
Anyone has an idea ?
I have the same problem.
It seems that it's possible to override a php class for a module if the class is in MyModule/MyClass.php, but it doesn't work if the class is in MyModule/lib/MyClass.php...

Where should I place my Vaadin 10+ static files?

In Vaadin 10-14, where should I place my static files, such as CSS, JavaScript, and Polymer templates? How about static files such as images?
Also, how do I import these files in Vaadin? Is there a difference between Vaadin 14 with npm and Vaadin 10-13 with bower?
All paths are relative to the project root, e.g. where the pom.xml file is located in a Maven project.
JavaScript imported using #JsModule uses strict mode. Among other things, this means that global variables must be defined on the window object, window.x = ..., instead of just x = ....
Vaadin 14 with npm
Non-Spring Boot projects (war packaging)
CSS files
#CssImport("./my-styles/styles.css")[1]
/frontend/my-styles/styles.css
JavaScript and Polymer templates
#JsModule("./src/my-script.js")[1]
/frontend/src/my-script.js
Static files, e.g. images
new Image("img/flower.jpg", "A flower")
/src/main/webapp/img/flower.jpg
Spring Boot projects (jar packaging)
CSS files
#CssImport("./my-styles/styles.css")[1]
/frontend/my-styles/styles.css
JavaScript and Polymer templates
#JsModule("./src/my-script.js")[1]
/frontend/src/my-script.js
Static files, e.g. images
new Image("img/flower.jpg", "A flower")
/src/main/resources/META-INF/resources/img/flower.jpg
Add-ons (jar packaging)
CSS files
#CssImport("./my-styles/styles.css")[1]
/src/main/resources/META-INF/resources/frontend/my-styles/styles.css
JavaScript and Polymer templates
#JsModule("./src/my-script.js")[1]
/src/main/resources/META-INF/resources/frontend/src/my-script.js
Static files, e.g. images
new Image("img/flower.jpg", "A flower")
/src/main/resources/META-INF/resources/img/flower.jpg
Vaadin 10-13, Vaadin 14 in compatibility mode
Non-Spring Boot projects (war packaging)
CSS files
#StyleSheet("css/styles.css")[2]
/src/main/webapp/frontend/css/styles.css
Polymer templates, custom-style and dom-module styles
#HtmlImport("src/template.html")
/src/main/webapp/frontend/src/template.html
JavaScript
#JavaScript("js/script.js")[3]
/src/main/webapp/frontend/js/script.js
Static files, e.g. images
new Image("img/flower.jpg", "A flower")
/src/main/webapp/img/flower.jpg
Spring Boot projects and add-ons (jar packaging)
CSS files
#StyleSheet("css/styles.css")[2]
/src/main/resources/META-INF/resources/frontend/css/styles.css
Polymer templates, custom-style and dom-module styles
#HtmlImport("src/template.html")
/src/main/resources/META-INF/resources/frontend/src/template.html
JavaScript
#JavaScript("js/script.js")[3]
/src/main/resources/META-INF/resources/frontend/js/script.js
Static files, e.g. images
new Image("img/flower.jpg", "A flower")
/src/main/resources/META-INF/resources/img/flower.jpg
Footnotes
[1] The #JsModule and #CssImport annotations can also be used for importing from an npm package. In this case, the path is defined as #JsModule("#polymer/paper-input") or #CssImport("some-package/style.css"). Paths referring to the local frontend directory should be prefixed with ./
[2] The #StyleSheet annotation can also be used in Vaadin 14 with npm. The same paths as in V10-V13 can be used, including the context:// protocol #StyleSheet("context://style.css"), which resolves the path relative to the context path of the web application, like other static files. Styles included this way may cause issues with web components.
[3] The #JavaScript annotation can also be used in Vaadin 14 with npm. The V14 /frontend folder should then be used,.
#Tazavoo 's answer has been added to the official Vaadin documentation:
Vaadin Resource Cheat sheet
I just wanted to put it here because I hope this will stay updated in the future. Please forgive me that I don't post the tables here but this answer will run over otherwise.
While Erik Lumme's answer is basically correct, I would like to share my experience about java script loading in a vaadin23 spring boot project, packaged as war. There are subtle differences about how the path must be indicated.
#JsModule:
path prefixed by "./": The path must be relative to the "frontend" folder
path without prefix: The path must be relative to the "node_modules" folder (maintained by npm).
Loading a java script by Page.addJavaScript(): The path must be relative to the root of the deployed application (in tomcat), rsp. to "src/main/webapp" in the project source.
We have shared resources of several Vaadin 14 modules like this:
маke common directory form project root /resources/static
route request there via nginx at prod and via Spring at local dev
public class MvcConfig implements WebMvcConfigurer {
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("file:./resources/static/")
.setCachePeriod(3600);
registry.setOrder(Integer.MAX_VALUE);
}
for css remove all
#CssImport("./styles/root/global-styles.css")
and put in MainView (#Route view), see https://vaadin.com/docs/v14/flow/styling/importing-style-sheets:
#StyleSheet("/static/css/global-styles.css")
for images put it to css
.plus-btn {
background: url("../static/icons/plus.svg") no-repeat center;
}

Extend the Laravel\Lumen\Exceptions\Handler.php inside package

I've got several Lumen services that have the same code inside the render() function within the App\Exceptions\Handler.php class. I want to move this code to a separate package that all of the services can include. I was able to get this working by making the package Handler.php file extend the Laravel\Lumen\Exceptions\Handler.php class, basically inserting my class between the default framework file and the Handler that users edit.
Change:
class Handler extends Laravel\Lumen\Exceptions\Handler {...}
To:
My class
use Laravel\Lumen\Exceptions\Handler;
class MyHandler extends Handler {...}
Framework class
use ServiceHelpers\Exceptions\MyHandler;
class Handler extends MyHandler {...}
However I ran into the problem where Laravel\Lumen\Exceptions\Handler doesn't exist when unit testing my file within the package. I've requires several illuminate/... packages in my composer file but it looks like the file I'm trying to extend is in the Laravel or Lumen framework and I'd have to require the laravel/lumen package which I don't think is appropriate.
I'm currently have the following required:
"illuminate/support": "^5.5",
"illuminate/http": "^5.5",
"illuminate/validation": "^5.5",
The error I'm getting is:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Laravel\Lumen\Exceptions\Handler' not found
Well, technically, your package depends on laravel/lumen-framework being installed, since it is extending a class from that package. Because of this, having laravel/lumen-framework as a dependency for your package is appropriate; your package depends on it being installed.

Spring Web Flux cannot resolve path to static content

I am using Spring Boot 2.0.0 M1 with WebFlux to build my sample web application. After succeeding with REST endpoints I've decided to add some views to my application. I've decided to use Thymeleaf 3.x version. I know that Spring serves static content from 4 default location:
/META-INF/resources/
/resources/
/static/
/public/
I've decided to go with second example so my css file is in /resources/static/css/. However after loading my page .css file was not found.
This is a screenshot from my IDE:
I am not providing my own configuration for static directory I just want to use default one. What might be important is the fact that templates are loading just fine from the /resources/templates/ directory.
Css file is loaded like this:
<link data-th-href="#{css/bootstrap.min.css}" rel="stylesheet">
App is not using normal Controller class instead I've provided function as a Bean to define my router:
#Bean
RouterFunction<?> router(final GeneratorHandler generatorHandler) {
return route(GET("/generate"), handler::render);
}
Any ideas what's wrong here?
I've found the right solution. In your RouterFunction you need to use:
return resources("/**", new ClassPathResource("/static/"))
This will set your static directory to:
:classpath/static

Mindscape Web Workbench Sass unknown mixin

I'm currently using Mindscape Web Workbench to create css from sass. I'm using an overall site.scss file that imports all other files.
/*** Infrastructure ***************************************/
/**********************************************************/
#import "../../Infrastructure/_Common";
#import "../../Layouts/Layout1/_Layout";
/*** Theming **********************************************/
/**********************************************************/
#import "_Theme";
Mixins that I have defined in _Common are not known in _Theme. when site.css is compiled it all works fine but Mindscape Web Workbench's intelisense thinks the mixins are undefined. Is there a way for the plugin to know these mixins are defined?
The SASS syntax of "#import" conflicts with .Net's syntax. When using SASS in .Net replace the "#import" with the keyword "#reference", and comment out the #reference (s). See http://getcassette.net/documentation/AssetReferences for more information.
Your code from above would be:
/*** Infrastructure ***************************************/
/**********************************************************/
/*
#reference "../../Infrastructure/_Common";
#reference "../../Layouts/Layout1/_Layout";
*/
/*** Theming **********************************************/
/**********************************************************/
/*
#reference "_Theme";
*/

Resources