Discussion:
best way to check for bootstrap
Chris McCoy
2014-02-26 18:31:25 UTC
Permalink
What would be the best way to check if bootstrap is added (enqueue) so I
don¹t load it twice.

Also any plans on adding bootstrap to core shipped scripts?
Nikola Nikolov
2014-02-26 18:52:25 UTC
Permalink
The best approach in my opinion is to use "bootstrap" as it's handle in
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.

Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue) so I
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Madalin Ignisca
2014-02-26 18:59:23 UTC
Permalink
Bootstrap from getbootstrap.com is a frontend framework that should be
available normally only on theme level.

If you're building a theme with Bootstrap, you should not worry that it
would be loaded by something else as it should not (if you find a plugin
that does it, well, the plugin author doesn't likes some good practices and
standards).

The theme is the presentation layer and the top layer of WordPress and only
it should handle this kinds of libraries.

It shouldn't be included in the core as there are dozens of alternatives
and Bootstrap isn't a standard, it's just popular; there are others better
done with more features then Bootstrap (well, maybe just my opinion).
Post by Nikola Nikolov
The best approach in my opinion is to use "bootstrap" as it's handle in
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.
Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue) so I
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
Chris McCoy
2014-02-26 19:01:30 UTC
Permalink
Reason I ask, is my plugin makes gravityforms into bootstrap, and I don’t
want to load the bootstrap css and js if its already loaded.

I know I could add an admin_notices saying bootstrap css/js required, etc.
Post by Madalin Ignisca
Bootstrap from getbootstrap.com is a frontend framework that should be
available normally only on theme level.
If you're building a theme with Bootstrap, you should not worry that it
would be loaded by something else as it should not (if you find a plugin
that does it, well, the plugin author doesn't likes some good practices and
standards).
The theme is the presentation layer and the top layer of WordPress and only
it should handle this kinds of libraries.
It shouldn't be included in the core as there are dozens of alternatives
and Bootstrap isn't a standard, it's just popular; there are others better
done with more features then Bootstrap (well, maybe just my opinion).
On Wed, Feb 26, 2014 at 8:52 PM, Nikola Nikolov
Post by Nikola Nikolov
The best approach in my opinion is to use "bootstrap" as it's handle in
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.
Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue)
so I
Post by Chris McCoy
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Madalin Ignisca
2014-02-26 19:14:48 UTC
Permalink
That's nice to find out of a plugin that alters gravity forms output
optimized for Bootstrap.

You could create an options page with a simple question: load bootstrap or
not?

Let the user choose.

I found the slug for bootstrap named in dozens of ways by theme authors and
you can't keep up with them as nobody respects a standard like use
something like "bootstrap" and "bootstrap-component". If everybody would do
that, we would have a better world :D

I think that leaving the option to the user to disable loading bootstrap
from your plugin is the best way, so play with conditions ;)
Post by Chris McCoy
Reason I ask, is my plugin makes gravityforms into bootstrap, and I don’t
want to load the bootstrap css and js if its already loaded.
I know I could add an admin_notices saying bootstrap css/js required, etc.
Post by Madalin Ignisca
Bootstrap from getbootstrap.com is a frontend framework that should be
available normally only on theme level.
If you're building a theme with Bootstrap, you should not worry that it
would be loaded by something else as it should not (if you find a plugin
that does it, well, the plugin author doesn't likes some good practices and
standards).
The theme is the presentation layer and the top layer of WordPress and only
it should handle this kinds of libraries.
It shouldn't be included in the core as there are dozens of alternatives
and Bootstrap isn't a standard, it's just popular; there are others better
done with more features then Bootstrap (well, maybe just my opinion).
On Wed, Feb 26, 2014 at 8:52 PM, Nikola Nikolov
Post by Nikola Nikolov
The best approach in my opinion is to use "bootstrap" as it's handle in
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.
Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue)
so I
Post by Chris McCoy
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
Chris McCoy
2014-02-26 20:34:51 UTC
Permalink
Ya for example, I looked at “the-bootstrap” on the themes directory on
wordpress.org

The handler used is tw-bootstrap

And for example strap press from bragthemes uses bootstrap-styles and
bootstrap-scripts for the bootstrap .css and .js

Probably the best way is to use an option
Post by Madalin Ignisca
That's nice to find out of a plugin that alters gravity forms output
optimized for Bootstrap.
You could create an options page with a simple question: load bootstrap or
not?
Let the user choose.
I found the slug for bootstrap named in dozens of ways by theme authors and
you can't keep up with them as nobody respects a standard like use
something like "bootstrap" and "bootstrap-component". If everybody would do
that, we would have a better world :D
I think that leaving the option to the user to disable loading bootstrap
from your plugin is the best way, so play with conditions ;)
Post by Chris McCoy
Reason I ask, is my plugin makes gravityforms into bootstrap, and I don’t
want to load the bootstrap css and js if its already loaded.
I know I could add an admin_notices saying bootstrap css/js required, etc.
Post by Madalin Ignisca
Bootstrap from getbootstrap.com is a frontend framework that should be
available normally only on theme level.
If you're building a theme with Bootstrap, you should not worry that it
would be loaded by something else as it should not (if you find a
plugin
Post by Madalin Ignisca
that does it, well, the plugin author doesn't likes some good practices and
standards).
The theme is the presentation layer and the top layer of WordPress and only
it should handle this kinds of libraries.
It shouldn't be included in the core as there are dozens of
alternatives
Post by Madalin Ignisca
and Bootstrap isn't a standard, it's just popular; there are others
better
Post by Madalin Ignisca
done with more features then Bootstrap (well, maybe just my opinion).
On Wed, Feb 26, 2014 at 8:52 PM, Nikola Nikolov
Post by Nikola Nikolov
The best approach in my opinion is to use "bootstrap" as it's handle
in
Post by Madalin Ignisca
Post by Nikola Nikolov
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.
Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue)
so I
Post by Chris McCoy
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Madalin Ignisca
2014-02-26 22:33:31 UTC
Permalink
that's right.

what's the plugin that alter's gravity forms? I'm interested a bit in as I
was using bootstrap's mixens on default gravity classes until now.
Post by Chris McCoy
Ya for example, I looked at “the-bootstrap” on the themes directory on
wordpress.org
The handler used is tw-bootstrap
And for example strap press from bragthemes uses bootstrap-styles and
bootstrap-scripts for the bootstrap .css and .js
Probably the best way is to use an option
Post by Madalin Ignisca
That's nice to find out of a plugin that alters gravity forms output
optimized for Bootstrap.
You could create an options page with a simple question: load bootstrap or
not?
Let the user choose.
I found the slug for bootstrap named in dozens of ways by theme authors and
you can't keep up with them as nobody respects a standard like use
something like "bootstrap" and "bootstrap-component". If everybody would do
that, we would have a better world :D
I think that leaving the option to the user to disable loading bootstrap
from your plugin is the best way, so play with conditions ;)
Post by Chris McCoy
Reason I ask, is my plugin makes gravityforms into bootstrap, and I don’t
want to load the bootstrap css and js if its already loaded.
I know I could add an admin_notices saying bootstrap css/js required, etc.
Post by Madalin Ignisca
Bootstrap from getbootstrap.com is a frontend framework that should be
available normally only on theme level.
If you're building a theme with Bootstrap, you should not worry that it
would be loaded by something else as it should not (if you find a
plugin
Post by Madalin Ignisca
that does it, well, the plugin author doesn't likes some good practices and
standards).
The theme is the presentation layer and the top layer of WordPress and only
it should handle this kinds of libraries.
It shouldn't be included in the core as there are dozens of
alternatives
Post by Madalin Ignisca
and Bootstrap isn't a standard, it's just popular; there are others
better
Post by Madalin Ignisca
done with more features then Bootstrap (well, maybe just my opinion).
On Wed, Feb 26, 2014 at 8:52 PM, Nikola Nikolov
Post by Nikola Nikolov
The best approach in my opinion is to use "bootstrap" as it's handle
in
Post by Madalin Ignisca
Post by Nikola Nikolov
wp_register/enqueue_style - after all you shouldn't really need different
version of bootstrap(or multiple instance of bootstrap) on the same page.
Of course you can probably hook late to wp_enqueue_scripts and go through
all of the enqueued styles and see if there's anything that contains
bootstrap. Obviously that's an overkill and will not always work.
Post by Chris McCoy
What would be the best way to check if bootstrap is added (enqueue)
so I
Post by Chris McCoy
don¹t load it twice.
Also any plans on adding bootstrap to core shipped scripts?
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Madalin Ignisca*
*web developer*
http://imadalin.ro/
Loading...