Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an article explaining how to use Bower in Symfony #5159

Merged
merged 1 commit into from
May 23, 2015

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Apr 8, 2015

Q A
Doc fix? no
New docs? yes
Applies to all
Fixed tickets -

The documentation was only documenting Assetic to manage assets. I feel like the community is moving away from Assetic and is starting to use tools like Bower, Gulp, Grunt, etc. This first article starts at documenting how to work with these tools within your Symfony application.

@wouterj wouterj force-pushed the frontend branch 2 times, most recently from 2d28844 to 38a11f6 Compare April 8, 2015 17:59

.. tip::

If you don't want to have NodeJS on your computer, you can also BowerPHP_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can also use/install

@cordoval
Copy link
Contributor

cordoval commented Apr 8, 2015

good job overall 👍 @wouterj , looking forward to Gulp and the other articles

========================

Symfony and all its packages are perfectly managed by Composer. Bower is a
dependency management tool for front-end dependencies, like Twitter Bootstrap
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They no longer call it Twitter Bootstrap but just Bootstrap

@wouterj
Copy link
Member Author

wouterj commented Apr 8, 2015

Thanks @cordoval and @javiereguiluz! I've applied almost all of your comments

@cordoval
Copy link
Contributor

cordoval commented Apr 8, 2015

👍

@rvanlaak
Copy link
Contributor

👍

Another helpfull note to ease the dependency deployment process would be to add the bower install command to the composer.json file scripts section:

    "scripts": {
        "post-install-cmd": [
            "bower install"
        ],
        "post-update-cmd": [
            "bower install"
        ]
    },

an alpha state. If you're using BowerPHP, use ``bowerphp`` instead of
``bower`` in the examples.

Configuring Bower in your Project
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, see #5155 (comment)

@Zeichen32
Copy link

There is also a very nice composer plugin, which does not require bower or npm to receive assets:
https://github.com/francoispluchino/composer-asset-plugin

@wouterj
Copy link
Member Author

wouterj commented Apr 13, 2015

Thanks for your comment @Zeichen32! However, I hate using Composer for anything other than PHP packages. So if anything, I wouldn't write something that recommends that :) The main point of all these different package managers is because they have another repository backend.

@javiereguiluz
Copy link
Member

@Zeichen32 thanks for your proposal. Don't worry about @wouterj's comment. I think he's right, because this article about Bower uses "pure JavaScript stuff". However, soon there will be another article (see #5166) which will use "pure PHP stuff". I'll gladly add a note about the project you mention that allows us to not touch JavaScript for anything!

@Zeichen32
Copy link

@javiereguiluz You're right, i did not notice the other article. 😉

Installing Bower
----------------

Bower_ is built on top of NodeJS_. Make sure you have that installed and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like Node.js seems to be the normal way to write it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 it's even what they use on their project's site

@weaverryan
Copy link
Member

@wouterj I like the initiative!

@aitboudad
Copy link
Contributor

👍

@wouterj
Copy link
Member Author

wouterj commented May 23, 2015

Thanks @weaverryan for your review. I've updated the article.

~~~~~~~~~~~~~~~~~~~~~~~~~

To create a ``bower.json`` file, just run ``bower init``. Now you're ready to
start adding things to your project. For example, to add `Bootstrap`_ to your
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The referenced URL at the end of the document is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

@cordoval
Copy link
Contributor

one of the things I have noticed lately is the move out of bower to npm. I don't think bower should be recommended anymore since unless you lock via sha1's this will could just be as unstable for things on production. npm however has shrinkwrap which will ensure things get locked rightly. So I would say to add a note about this to really address things the right way. The situation in the js world is as if there were two composers. One with more right to claim package management already in this case npm. Of course you need to install node for both anyways so I wonder what is the point of using bower.

@wouterj
Copy link
Member Author

wouterj commented May 23, 2015

Npm is created for Node.js development, with all kind of extra features for Node.js. Bower on the other hand is written in Node.js, but created specifically for managing front-end packages, with all kind of features that are related to this.

Npm for instance downloads the complete package, including all build files, source, etc. Bower will only install things that are really needed, like the dist files. This means that when using npm, you also need to create a build script to only move the needed dist files to the web/assets/ directory.

I'm a big -1 on recommending npm instead of bower.

@cordoval
Copy link
Contributor

I would agree with you were it not the case that npm is already installed. It is imo like recommending a wrong practice [to install more stuff than needed]. I have also seen lots of packages migrating to the right npm package managing, though not all. Also there is a PR in bower trying to do the lock which is not merged so big disadvantage. And you are bypassing the stability that a lock feature begs for which is desired to make the frontend truly stable for production. Otherwise everytime you run bower install you could be getting new stuff even on production. But your choice 👴

@weaverryan weaverryan merged commit d34b772 into symfony:2.3 May 23, 2015
weaverryan added a commit that referenced this pull request May 23, 2015
… (WouterJ)

This PR was merged into the 2.3 branch.

Discussion
----------

Added an article explaining how to use Bower in Symfony

| Q | A
| --- | ---
| Doc fix? | no
| New docs? | yes
| Applies to | all
| Fixed tickets | -

The documentation was only documenting Assetic to manage assets. I feel like the community is moving away from Assetic and is starting to use tools like Bower, Gulp, Grunt, etc. This first article starts at documenting how to work with these tools within your Symfony application.

Commits
-------

d34b772 Created Bower article
@weaverryan
Copy link
Member

Merged! I think this is an easy win because people can easily find this article, but it's short and avoids any major maintenance of duplication. I would like to see more articles like this that answer a question a user has, even if the answer is simply pointing them to another tool(s) to use.

About npm versus bower, Wouter explained it perfectly. Here is the SO explaining it: http://stackoverflow.com/questions/18641899/what-is-the-difference-between-bower-and-npm#answers-header

But, I did open #5294, which discusses the problem if having no lock file (currently) for Bower.

Thanks!

@wouterj wouterj deleted the frontend branch May 23, 2015 14:54
weaverryan added a commit that referenced this pull request May 23, 2015
…eaverryan)

This PR was merged into the 2.3 branch.

Discussion
----------

Tweaks to bower entry - specifically committing deps

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | n/a

This follows after #5159. The biggest addition is a short conversation about committing Bower assets.

Thanks!

Commits
-------

7f4b55e Many tweaks thanks to the team!
d526765 Small tweaks, but mostly adding a section about committing Bower assets
weaverryan added a commit that referenced this pull request Jun 27, 2015
…ith Assetic (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Proposed a new article about using pure PHP libraries with Assetic

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes
| Applies to    | all
| Fixed tickets | -

In #5159 @wouterj proposes to create a new Cookbook section dedicated to frontend articles. I think it's a great idea and in this pull request I propose an article showing how to use pure PHP libraries to combine, compile and minimize CSS, SCSS and JS files.

Commits
-------

f5c4d93 Fixed an indentation problem
4b8b3fb Moved the article back to the Assetic section
07087dd Avoid the ugly double back slashes
85e6a54 Added more configuration formats
bc6ffbe Rewords and code improvements
3ea9c86 Fixed some typos and grammar issues
1f6e16c Minor fixes
cc5b630 Reworded some wrong statements
044cd73 The file extension is not needed
14d0346 Fixed the Twig lexer name
798b5b5 Added the missin index file
86da338 Proposed a new article about using pure PHP libraries with Assetic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants