Re: Tapestry default style sheet change doesn't seem to kick in

2022-03-06 Thread Thiago H. de Paula Figueiredo
On Tue, Feb 15, 2022 at 4:13 PM Feng Gao  wrote:

> Hello!
>

Hello!


> I followed instructions on https://tapestry.apache.org/css.html to change
> Tapestry (v5.7.3) default stylesheet to use Bootstrap-4.6.1 stylesheet,
> instead of the default Bootstrap-4.3.1:
>
> Here's what I ended up with in AppModule.java
> @ImportModule(NoBootstrapModule.class)
> public class AppModule
> {
> ...
> @ApplicationDefaults
> @Contribute(SymbolProvider.class)
> public static void setupEnvironment(final MappedConfiguration String> configuration)
> {
> ..
>configuration.add(SymbolConstants.DEFAULT_STYLESHEET,
> "context:css/bootstrap-4.6.1-dist/css/bootstrap.css");
> }
> }
>

I believe you're making a contribution to the wrong service: it should be
to ApplicationDefaults directly, not to SymbolProvider.

I suggest you try this:

public static void contributeApplicationDefaults(final
> MappedConfiguration configuration)
> {
> ..
>configuration.add(SymbolConstants.DEFAULT_STYLESHEET,
> "context:css/bootstrap-4.6.1-dist/css/bootstrap.css");
> }
> }
>

Please let us know if it works.

Also, I believe the approach suggested by Bob is the most recommended one,
since you're just replacing the Bootstrap version. Using NoBootstrapModule
is intended for when you're not using Bootstrap at all.

--
Thiago


Re: Tapestry default style sheet change doesn't seem to kick in

2022-02-15 Thread Bob Harner
I'll take a crack at this.

In your application module class (normally AppModule.java), set the Symbol
constants.BOOTSTRAP_ROOT symbol to where your replacement bootstrap files
are installed (the parent of the bootstrap css and js subfolders). As far
as I understand, there are no other changes needed to have Tapestry use
your version of Bootstrap. See the "Overriding Bootstrap (Tapestry 5.4 and
later)" section of https://tapestry.apache.org/css.html

On Tue, Feb 15, 2022, 2:13 PM Feng Gao  wrote:

> Hello!
>
> I followed instructions on https://tapestry.apache.org/css.html to change
> Tapestry (v5.7.3) default stylesheet to use Bootstrap-4.6.1 stylesheet,
> instead of the default Bootstrap-4.3.1:
>
> *Tapestry 5.5.0 and later also allows you to have Tapestry not
> provide any CSS at all. To do that, just add
> @ImportModule(NoBootstrapModule.class) to your module class. In this case,
> you'll need to set the tapestry.default-stylesheet
> (SymbolConstants#DEFAULT_STYLESHEET) configuration symbol to tell Tapestry
> what's your main CSS file. Otherwise, an exception will be thrown and the
> webapp won't start.
>
> Here's what I ended up with in AppModule.java
> @ImportModule(NoBootstrapModule.class)
> public class AppModule
> {
> ...
> @ApplicationDefaults
> @Contribute(SymbolProvider.class)
> public static void setupEnvironment(final MappedConfiguration String> configuration)
> {
> ..
>configuration.add(SymbolConstants.DEFAULT_STYLESHEET,
> "context:css/bootstrap-4.6.1-dist/css/bootstrap.css");
> }
> }
>
> css/bootstrap-4.6.1-dist/css/bootstrap.css is included in the webapp
> folder. When the application runs after the above changes, it still shows
> the default Bootstrap css (v4.3.1).
>  href="/MyApp/assets/meta/zae851f6d/tapestry5/bootstrap4/css/bootstrap.css">
> /*!
> *Bootstrap v4.3.1 (https://getbootstrap.com/)
> *Copyright 2011-2019 The Bootstrap Authors
> *Copyright 2011-2019 Twitter, Inc. * Licensed under MIT (
> https://github.com/twbs/bootstrap/blob/master/LICENSE)
> */
> Do you see what might be missing or mistaken? Please advise.
>
> Thank you!
> Feng Gao
>


Tapestry default style sheet change doesn't seem to kick in

2022-02-15 Thread Feng Gao
Hello!

I followed instructions on https://tapestry.apache.org/css.html to change 
Tapestry (v5.7.3) default stylesheet to use Bootstrap-4.6.1 stylesheet, instead 
of the default Bootstrap-4.3.1:

*Tapestry 5.5.0 and later also allows you to have Tapestry not provide 
any CSS at all. To do that, just add @ImportModule(NoBootstrapModule.class) to 
your module class. In this case, you'll need to set the 
tapestry.default-stylesheet (SymbolConstants#DEFAULT_STYLESHEET) configuration 
symbol to tell Tapestry what's your main CSS file. Otherwise, an exception will 
be thrown and the webapp won't start.

Here's what I ended up with in AppModule.java
@ImportModule(NoBootstrapModule.class)
public class AppModule
{
...
@ApplicationDefaults
@Contribute(SymbolProvider.class)
public static void setupEnvironment(final MappedConfiguration configuration)
{
..
   configuration.add(SymbolConstants.DEFAULT_STYLESHEET, 
"context:css/bootstrap-4.6.1-dist/css/bootstrap.css");
}
}

css/bootstrap-4.6.1-dist/css/bootstrap.css is included in the webapp folder. 
When the application runs after the above changes, it still shows the default 
Bootstrap css (v4.3.1).

/*!
*Bootstrap v4.3.1 (https://getbootstrap.com/)
*Copyright 2011-2019 The Bootstrap Authors
*Copyright 2011-2019 Twitter, Inc. * Licensed under MIT 
(https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
Do you see what might be missing or mistaken? Please advise.

Thank you!
Feng Gao