diff --git a/.gitignore b/.gitignore index 9ee34283f9e2..ed687040e282 100644 --- a/.gitignore +++ b/.gitignore @@ -201,3 +201,6 @@ project.lock.json **/sample/**/wwwroot/lib/ **/samples/**/wwwroot/lib/ __pycache__/ + +#Mac OSX +.DS_Store \ No newline at end of file diff --git a/aspnet/client-side/bower.rst b/aspnet/client-side/bower.rst index 01bd8bc75d2f..72f4fa92a76a 100644 --- a/aspnet/client-side/bower.rst +++ b/aspnet/client-side/bower.rst @@ -3,7 +3,7 @@ Manage Client-Side Packages with Bower ====================================== -By `Noel Rice`_, `Scott Addie`_ +By `Noel Rice`_, `Scott Addie`_, and `Shayne Boyer`_ Bower is a "package manager for the web." Bower lets you install and restore client-side packages, including JavaScript and CSS libraries. For example, with Bower you can install CSS files, fonts, client frameworks, and JavaScript libraries from external sources. Bower resolves dependencies and will automatically download and install all the packages you need. For example, if you configure Bower to load the Bootstrap package, the necessary jQuery package will automatically come along for the ride. For .NET libraries you still use NuGet_ package manager. @@ -12,42 +12,42 @@ Bower is a "package manager for the web." Bower lets you install and restore cli Getting Started with Bower -------------------------- -ASP.NET Core project templates pre-construct the client build process for you. The ubiquitous jQuery and Bootstrap packages are installed, and the plumbing for NPM, Gulp, and Bower is already in place. The screenshot below depicts the initial project in Solution Explorer. It's important to enable the "Show All Files" option, as the bower.json file is hidden by default. +ASP.NET Core project templates pre-construct the client build process for you. The ubiquitous jQuery and Bootstrap packages are installed, and the plumbing for Bower is already in place. The screenshot below depicts the initial project in Solution Explorer. It's important to enable the "Show All Files" option, as the bower.json file is hidden by default. .. image:: bower/_static/mvc-project.png :width: 300px Client-side packages are listed in the bower.json file. The ASP.NET Core project template pre-configures bower.json with jQuery, jQuery validation, and Bootstrap. -Let’s add support for photo albums by installing the `Fotorama `_ jQuery plugin. Bower packages can be installed either via the Manage Bower Packages UI or manually in the bower.json file. +Let’s add support for `Font Awesome `_ to add some scalable vector css icons to the HTML. Bower packages can be installed either via the Manage Bower Packages UI or manually in the bower.json file. Installation via Manage Bower Packages UI ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -#. Right-click the project name in Solution Explorer, and select the "Manage Bower Packages" menu option. +- Right-click the project name in Solution Explorer, and select the "Manage Bower Packages" menu option. -#. In the window that appears, click the "Browse" tab, and filter the packages list by typing "fotorama" into the search box: +- In the window that appears, click the "Browse" tab, and filter the packages list by typing "font-awesome" into the search box: .. image:: bower/_static/manage-bower-packages.png -#. Confirm that the "Save changes to bower.json" checkbox is checked, select the desired version from the drop-down list, and click the Install button. +- Confirm that the "Save changes to bower.json" checkbox is checked, select the desired version from the drop-down list, and click the Install button. -#. Across the bottom status bar of the IDE, an *Installing "fotorama" complete* message appears to indicate a successful installation. +- Across the bottom status bar of the IDE, an *Installing "font-awesome" complete* message appears to indicate a successful installation. Manual Installation in bower.json ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -#. At the end of the ``dependencies`` section in bower.json, add a comma and type "fotorama". Notice as you type that you get IntelliSense with a list of available packages. Select "fotorama" from the list. +- At the end of the ``dependencies`` section in bower.json, add a comma and type "font-awesome". Notice as you type that you get IntelliSense with a list of available packages. Select "font-awesome" from the list. .. image:: bower/_static/add-package.png - :width: 150px -#. Add a colon and then select the latest stable version of the package from the drop-down list. The double quotes will be added automatically. +- Add a colon and then select the latest stable version of the package from the drop-down list. The double quotes will be added automatically. .. image:: bower/_static/version-intellisense.png - :width: 200px -#. Save the bower.json file. + .. note:: Bower uses `semantic versioning `_ to organize dependencies. Semantic versioning, also known as SemVer, identifies packages with the numbering scheme ... Intellisense simplifies semantic versioning by showing only a few common choices. The top item in the Intellisense list (4.6.3 in the example above) is considered the latest stable version of the package. The caret (^) symbol matches the most recent major version and the tilde (~) matches the most recent minor version. + +- Save the bower.json file. .. note:: Visual Studio watches the bower.json file for changes. Upon saving, the `bower install` command is executed. See the Output window's "Bower/npm" view for the exact command which was executed. @@ -59,39 +59,61 @@ Now that the installation step has been completed, expand the twisty to the left "directory": "wwwroot/lib" } -In Solution Explorer, expand the *wwwroot* node. The *lib* directory should now contain all of the packages, including the fotorama package. +In Solution Explorer, expand the *wwwroot* node. The *lib* directory should now contain all of the packages, including the font-awesome package. .. image:: bower/_static/package-lib.png :width: 300px -Next, let's add an HTML page to the project. In Solution Explorer, right-click *wwwroot* node and select **Add** > **New Item** > **HTML Page**. Name the page Index.html. Replace the contents of the file with the following: +Let's add the Font Awesome Icons to the Home Page. Open ``Views\Shared\_Layout.cshtml`` and add the css resource to the environment tag helper for **Development**. -.. code-block:: html + .. code-block:: html + :emphasize-lines: 4 - - - - - Bower and Fotorama - - - -
- - - - -
- - - - + + + + + + +In the environment tag helper for **Staging,Production**, use the CDN location of the css resource and the local file as the fallback. If the CDN fails, then the local file will be used. + + .. code-block:: html + :emphasize-lines: 5,6 + + + + + + -This example uses images currently available inside *wwwroot/images*, but you can add any images on hand. +Open ``Views\Home\Index.cshtml`` and add the icons to the **How to**, **Overview**, and **Run & Deploy** headers. You'll notice when typing, IntelliSense is available on the css classes. -Press ``Ctrl+Shift+W`` to display the page in the browser. The control displays the images and allows navigation by clicking the thumbnail list below the main image. This quick test shows that Bower installed the correct packages and dependencies. + .. image:: bower/_static/css-intellisense.png + +Add the question icon to the **How to** header. + + .. code-block:: html + :emphasize-lines: 2 + + + +Run the application to see the changes. -.. image:: bower/_static/photo-gallery.png + .. image:: bower/_static/app-with-icons.png Exploring the Client Build Process ---------------------------------- diff --git a/aspnet/client-side/bower/_static/add-package.png b/aspnet/client-side/bower/_static/add-package.png index ca4813713ae9..25243fe97997 100644 Binary files a/aspnet/client-side/bower/_static/add-package.png and b/aspnet/client-side/bower/_static/add-package.png differ diff --git a/aspnet/client-side/bower/_static/app-with-icons.png b/aspnet/client-side/bower/_static/app-with-icons.png new file mode 100644 index 000000000000..c38e9272f97f Binary files /dev/null and b/aspnet/client-side/bower/_static/app-with-icons.png differ diff --git a/aspnet/client-side/bower/_static/css-intellisense.png b/aspnet/client-side/bower/_static/css-intellisense.png new file mode 100644 index 000000000000..c3d103a6ac03 Binary files /dev/null and b/aspnet/client-side/bower/_static/css-intellisense.png differ diff --git a/aspnet/client-side/bower/_static/manage-bower-packages.png b/aspnet/client-side/bower/_static/manage-bower-packages.png index 6174f9f38d09..f225e0e8de27 100644 Binary files a/aspnet/client-side/bower/_static/manage-bower-packages.png and b/aspnet/client-side/bower/_static/manage-bower-packages.png differ diff --git a/aspnet/client-side/bower/_static/mvc-project.png b/aspnet/client-side/bower/_static/mvc-project.png index a6d8f98da1be..1c8296c45872 100644 Binary files a/aspnet/client-side/bower/_static/mvc-project.png and b/aspnet/client-side/bower/_static/mvc-project.png differ diff --git a/aspnet/client-side/bower/_static/package-lib.png b/aspnet/client-side/bower/_static/package-lib.png index 037c1915c656..2233386e3ad4 100644 Binary files a/aspnet/client-side/bower/_static/package-lib.png and b/aspnet/client-side/bower/_static/package-lib.png differ diff --git a/aspnet/client-side/bower/_static/version-intellisense.png b/aspnet/client-side/bower/_static/version-intellisense.png index 2626c1cffdf1..7a8bce9602b7 100644 Binary files a/aspnet/client-side/bower/_static/version-intellisense.png and b/aspnet/client-side/bower/_static/version-intellisense.png differ diff --git a/aspnet/client-side/bundling-and-minification/.DS_Store b/aspnet/client-side/bundling-and-minification/.DS_Store new file mode 100644 index 000000000000..c7f15f9d7226 Binary files /dev/null and b/aspnet/client-side/bundling-and-minification/.DS_Store differ