issue87:command_conquer
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue87:command_conquer [2015/01/08 21:04] – [4] fredphil91 | issue87:command_conquer [2015/01/10 17:49] (Version actuelle) – [10] auntiee | ||
---|---|---|---|
Ligne 6: | Ligne 6: | ||
SASS – stands for “Syntactically Awesome Style Sheets”, and is a format you can use to generate typical CSS. However, it provides extra features which makes it easier for the programmer, while still compiling into normal CSS. Such as: functions, variables (i.e. defining colors in the header, so changing the color requires only one change), nesting of selectors, and mixins (mini functions to convert one line of code into many). Also referred to as SCSS.** | SASS – stands for “Syntactically Awesome Style Sheets”, and is a format you can use to generate typical CSS. However, it provides extra features which makes it easier for the programmer, while still compiling into normal CSS. Such as: functions, variables (i.e. defining colors in the header, so changing the color requires only one change), nesting of selectors, and mixins (mini functions to convert one line of code into many). Also referred to as SCSS.** | ||
- | Ce mois-ci j'ai pensé faire un lien avec notre série d' | + | Ce mois-ci j'ai pensé faire un lien avec notre série d' |
Définitions | Définitions | ||
- | SASS - signifie « Syntactically Awesome Style Sheets » [Ndt : feuilles de style syntaxiquement impressionnantes] et est un format que vous pouvez utiliser pour générer du CSS standard. Cependant, il fournit des fonctionnalités supplémentaires qui facilitent la vie du programmeur, | + | SASS - signifie « Syntactically Awesome Style Sheets » [Ndt : feuilles de style syntaxiquement impressionnantes] et c'est un format que vous pouvez utiliser pour générer du CSS standard. Cependant, il fournit des fonctionnalités supplémentaires qui facilitent la vie du programmeur, |
====== 2 ====== | ====== 2 ====== | ||
Ligne 20: | Ligne 20: | ||
Grunt - “The JavaScript Task Runner” - this is essentially a file and folder watcher, that executes user-defined commands when something changes. I typically use it only for compiling SASS into CSS files, but it could do much more.** | Grunt - “The JavaScript Task Runner” - this is essentially a file and folder watcher, that executes user-defined commands when something changes. I typically use it only for compiling SASS into CSS files, but it could do much more.** | ||
- | Node.js - « c'est une plateforme basée sur l' | + | Node.js - « c'est une plateforme basée sur l' |
NPM - « Node Packaged Modules » (essentiellement un dépôt pour les applications Node). | NPM - « Node Packaged Modules » (essentiellement un dépôt pour les applications Node). | ||
Ligne 42: | Ligne 42: | ||
sudo ln -s / | sudo ln -s / | ||
- | Pré-requis (testés avec 14.04) | + | Pré-requis (testés avec la 14.04) |
Installer Node.js et NPM : | Installer Node.js et NPM : | ||
Ligne 87: | Ligne 87: | ||
npm install** | npm install** | ||
+ | |||
+ | Créez un fichier package.json qui contient les éléments suivants (ou exécutez npm init) : http:// | ||
+ | |||
+ | Naturellement, | ||
+ | |||
+ | npm install < | ||
+ | |||
+ | Remplacez < | ||
+ | |||
+ | Installez les modules nécessaires dans packages.json en exécutant la commande suivante dans le dossier du projet : | ||
+ | |||
+ | npm install | ||
====== 6 ====== | ====== 6 ====== | ||
Ligne 97: | Ligne 109: | ||
The way the Gruntfile works is that you define objects for various sections of your project – for example the project object contains the paths to each section of your app folder (and they can be referenced with project.app, | The way the Gruntfile works is that you define objects for various sections of your project – for example the project object contains the paths to each section of your app folder (and they can be referenced with project.app, | ||
+ | |||
+ | Pour SASS, vous aurez également besoin d' | ||
+ | |||
+ | Créez votre Gruntfile (soit Gruntfile.js soit Gruntfile.coffee). Voici le fichier que j' | ||
+ | |||
+ | Le format des dossiers est alors : app/ | ||
+ | |||
+ | La façon dont le Gruntfile fonctionne est que vous définissez des objets pour différentes sections de votre projet - par exemple l' | ||
====== 7 ====== | ====== 7 ====== | ||
Ligne 103: | Ligne 123: | ||
You can also define an uglify object using grunt-contrib-uglify to minify JavaScript files. More information can be found here: https:// | You can also define an uglify object using grunt-contrib-uglify to minify JavaScript files. More information can be found here: https:// | ||
+ | |||
+ | La section saas est relativement standard : elle indique où iront les fichiers CSS, que, en cours de développement, | ||
+ | |||
+ | Vous pouvez également définir un objet « uglify » en utilisant grunt-contrib-uglify pour rapetisser les fichiers JavaScript. Vous trouverez plus d' | ||
====== 8 ====== | ====== 8 ====== | ||
Ligne 119: | Ligne 143: | ||
Run: grunt** | Run: grunt** | ||
+ | |||
+ | Puisque le Gruntfile par défaut exécute sass:dev (avec les styles étendus), vous pouvez exécuter sass:dist vous-même avec la commande suivante : | ||
+ | |||
+ | grunt sass:dist | ||
+ | |||
+ | Ceci créera alors un fichier css compressé, à utiliser dans un environnement de production. | ||
+ | |||
+ | Mise en route (à l'aide d'un environnement ou d'un thème de démarrage qui utilise Grunt). | ||
+ | |||
+ | Allez dans le répertoire de l' | ||
+ | |||
+ | Exécutez : npm install | ||
+ | |||
+ | Exécutez : grunt | ||
====== 9 ====== | ====== 9 ====== | ||
Ligne 131: | Ligne 169: | ||
What you might notice is that it even converted the specified hex values for the colors into the CSS keywords “black” and “white”, | What you might notice is that it even converted the specified hex values for the colors into the CSS keywords “black” and “white”, | ||
+ | |||
+ | Commencez à éditer les fichiers SASS et laissez grunt faire son travail ! | ||
+ | |||
+ | Les styles | ||
+ | |||
+ | Comme exemple de ce que peut faire SASS, j'ai créé ce fichier : http:// | ||
+ | |||
+ | Il est ensuite compilé en css normal, comme on le voit dans ce fichier : http:// | ||
+ | |||
+ | Vous pourrez remarquer qu'il a même converti les valeurs hexa spécifiées pour les couleurs en mots-clés CSS « black » et « white », et que le « mixin » a créé toutes les lignes de code pour tous les navigateurs en utilisant les valeurs et le format corrects. Cela signifie que, si vous avez besoin d' | ||
====== 10 ====== | ====== 10 ====== | ||
Ligne 145: | Ligne 193: | ||
Hopefully this article has piqued your interest in SASS. If there is any interest in another article on SASS specifically, | Hopefully this article has piqued your interest in SASS. If there is any interest in another article on SASS specifically, | ||
+ | |||
+ | Cela illustre ce qu'est un « mixin » (linear-gradient), | ||
+ | |||
+ | body { | ||
+ | a { | ||
+ | &: | ||
+ | |||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | J' | ||
+ |
issue87/command_conquer.1420747444.txt.gz · Dernière modification : 2015/01/08 21:04 de fredphil91