├── .eslintrc
├── .gitignore
├── LICENSE
├── README.md
├── bootstrap-sass-no-customizations.config.js
├── bootstrap-sass-scripts.loader.js
├── bootstrap-sass-styles.loader.js
├── bootstrap-sass.config.js
├── bootstrapSassPath.js
├── index.js
├── index.loader.js
├── jetbrains-inspection
└── Inspection_RailsOnMaui_Default.xml
├── logger.js
└── package.json
/.eslintrc:
--------------------------------------------------------------------------------
1 | # ESLint documentation can be found at http://eslint.org/docs/
2 | env:
3 | browser: true
4 | node: true
5 | amd: false
6 | mocha: true
7 | jasmine: false
8 | rules:
9 | no-alert: 2
10 | no-array-constructor: 2
11 | no-bitwise: 0
12 | no-caller: 2
13 | no-catch-shadow: 2
14 | no-comma-dangle: 2
15 | no-cond-assign: [2, 'always']
16 | no-console: 0
17 | no-constant-condition: 2
18 | no-control-regex: 2
19 | no-debugger: 2
20 | no-delete-var: 2
21 | no-div-regex: 0
22 | no-dupe-keys: 2
23 | no-dupe-args: 2
24 | no-duplicate-case: 2
25 | no-else-return: 2
26 | no-empty: 2
27 | no-empty-class: 2
28 | no-empty-label: 2
29 | no-eq-null: 2
30 | no-eval: 2
31 | no-ex-assign: 2
32 | no-extend-native: 2
33 | no-extra-bind: 2
34 | no-extra-boolean-cast: 2
35 | no-extra-parens: 0
36 | no-extra-semi: 2
37 | no-fallthrough: 2
38 | no-floating-decimal: 0
39 | no-func-assign: 2
40 | no-implied-eval: 2
41 | no-inline-comments: 0
42 | no-inner-declarations: [2, 'functions']
43 | no-invalid-regexp: 2
44 | no-irregular-whitespace: 2
45 | no-iterator: 2
46 | no-label-var: 2
47 | no-labels: 2
48 | no-lone-blocks: 2
49 | no-lonely-if: 2
50 | no-loop-func: 2
51 | no-mixed-requires: [0, false]
52 | no-mixed-spaces-and-tabs: [2, false]
53 | no-multi-spaces: 2
54 | no-multi-str: 2
55 | no-multiple-empty-lines: [2, {max: 2}]
56 | no-native-reassign: 2
57 | no-negated-in-lhs: 2
58 | no-nested-ternary: 0
59 | no-new: 2
60 | no-new-func: 2
61 | no-new-object: 2
62 | no-new-require: 0
63 | no-new-wrappers: 2
64 | no-obj-calls: 2
65 | no-octal: 2
66 | no-octal-escape: 2
67 | no-path-concat: 0
68 | no-plusplus: 0
69 | no-process-env: 0
70 | no-process-exit: 0
71 | no-proto: 2
72 | no-redeclare: 2
73 | no-regex-spaces: 2
74 | no-reserved-keys: 0
75 | no-restricted-modules: 0
76 | no-return-assign: 2
77 | no-script-url: 2
78 | no-self-compare: 2
79 | no-sequences: 2
80 | no-shadow: 2
81 | no-shadow-restricted-names: 2
82 | no-space-before-semi: 2
83 | no-spaced-func: 2
84 | no-sparse-arrays: 2
85 | no-sync: 0
86 | no-ternary: 0
87 | no-trailing-spaces: 2
88 | no-undef: 2
89 | no-undef-init: 2
90 | no-undefined: 0
91 | no-underscore-dangle: 0
92 | no-unreachable: 2
93 | no-unused-expressions: 2
94 | no-unused-vars: [2, {vars: 'all', args: 'none'}]
95 | no-use-before-define: 2
96 | no-void: 2
97 | no-var: 0
98 | no-warning-comments: [0, {terms: ['todo', 'fixme', 'xxx'], location: 'start'}]
99 | no-with: 2
100 | no-wrap-func: 2
101 | block-scoped-var: 2
102 | brace-style: 2
103 | camelcase: 0
104 | comma-spacing: 2
105 | comma-style: 2
106 | complexity: [0, 11]
107 | consistent-return: 2
108 | consistent-this: [2, 'self']
109 | curly: [2, 'all']
110 | default-case: 0
111 | dot-notation: [2, {allowKeywords: true}]
112 | eol-last: 2
113 | eqeqeq: 2
114 | func-names: 0
115 | func-style: [2, 'declaration']
116 | generator-star: 0
117 | guard-for-in: 0
118 | handle-callback-err: 2
119 | indent: [2, 2]
120 | key-spacing: [2, {beforeColon: false, afterColon: true}]
121 | max-depth: [1, 4]
122 | max-len: [2, 100]
123 | max-nested-callbacks: [1, 2]
124 | max-params: [1, 4]
125 | max-statements: [0, 10]
126 | new-cap: 2
127 | new-parens: 2
128 | one-var: 0
129 | operator-assignment: [0, 'always']
130 | padded-blocks: 0
131 | quote-props: 0
132 | quotes: [2, 'single']
133 | radix: 2
134 | semi: 2
135 | sort-vars: 0
136 | space-after-function-name: [0, 'never']
137 | space-after-keywords: 2
138 | space-before-blocks: 2
139 | space-before-function-parentheses: [2, 'never']
140 | space-in-brackets: 2
141 | space-in-parens: 2
142 | space-infix-ops: 2
143 | space-return-throw-case: 2
144 | space-unary-ops: [2, {words: true, nonwords: false}]
145 | spaced-line-comment: 2
146 | strict: [2, 'never']
147 | use-isnan: 2
148 | valid-jsdoc: 2
149 | valid-typeof: 2
150 | vars-on-top: 0
151 | wrap-iife: 0
152 | wrap-regex: 0
153 | yoda: [2, 'never']
154 | globals:
155 | Promise: true
156 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | npm-debug.log
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Justin Gordon (based on work by Dylan Lukes & Scott Bleck)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Aloha from Justin Gordon and the [ShakaCode](http://www.shakacode.com) Team! We need your help. Venture capital funding has slowed and, for the first time, my ShakaCode team is actively looking for our next project. If you like **React on Rails**, please consider contacting me if we could potentially help you in any way. I'm offering a free half hour project consultation, on anything from React on Rails to any aspect of web application development, including both consumer and enterprise products. You can read more about my background [here](http://www.railsonmaui.com/about). Whether you have a new project, or need help on an existing project, please email me directly at [justin@shakacode.com](mailto:justin@shakacode.com). And thanks in advance for any referrals! Your support keeps this project going.
2 |
3 | # bootstrap-sass-loader
4 |
5 | **DEPRECATED**
6 |
7 | We're moving to a new project name and slightly different file format.
8 |
9 | ## New Locations
10 | The new npm libs and corresponding github repos are:
11 |
12 | 1. [bootstrap-loader](https://github.com/shakacode/bootstrap-loader)
13 | 1. [sass-resources-loader](https://github.com/shakacode/sass-resources-loader)
14 |
15 | ## New Features
16 | 1. Supports Bootstrap v3 and v4
17 | 1. Easier to remove jQuery
18 | 1. Supports CSS Modules
19 |
20 | This new system is currently used by the live demo of [reactrails.com](http://www.reactrails.com). You can find the source code here: [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial).
21 |
22 | That being said, the current version will probably keep working, so there's no urgency to upgrade.
23 |
24 | ## Upgrade Instructions
25 |
26 | 1. Change your dependency for bootstrap as shown [here](https://github.com/shakacode/bootstrap-loader#usage). Basically, you will want to configure `bootstrap-loader` as an entry point. Or you might configure `bootstrap-loader/extractStyles` as an entry point, as shown [here](https://github.com/shakacode/bootstrap-loader#extractstyles). Note, you no longer specify the name of your bootstrap customization file.
27 | 1. Follow the instructions [here](https://github.com/shakacode/bootstrap-loader#installation) for configuring the npm library for Bootstrap.
28 | 1. If you're using the bootstrap jQuery plugins, configure it like [this](https://github.com/shakacode/bootstrap-loader#jquery).
29 | 1. If you have no customization file, then you're done.
30 | 1. Otherwise, rename your customization file to `.bootstraprc`. See sample file [.bootstraprc-3-default](https://github.com/shakacode/bootstrap-loader/blob/master/.bootstraprc-3-default) for how to migrate your existing `bootstrap-sass-config` file.
31 |
32 |
33 | bootstrap-sass-loader (please upgrade to bootstrap-loader)
34 | =================
35 |
36 | [](https://badge.fury.io/js/bootstrap-sass-loader)
37 |
38 | Bootstrap configuration and loading package for webpack, using the npm packages `bootstrap-sass` and `sass-loader`.
39 |
40 | Install from [bootstrap-sass-loader on npm](https://www.npmjs.com/package/bootstrap-sass-loader).
41 |
42 | If you're looking for the less version, see [bootstrap-webpack](https://github.com/gowravshekar/bootstrap-webpack). This project
43 | is based on that version for less, with some minor differences, the main one being how the configuration file specifies
44 | two sass files for customization.
45 |
46 | In a nutshell:
47 |
48 | 1. You've got the sass-loader to process Sass files to CSS.
49 | 2. The npm bootstrap-sass package places the bootstrap files in `/node_modules/bootstrap-sass/assets`.
50 | 3. You could simply create your own sass file to pick up bootstrap from this location, and you could require the js
51 | files here for the Bootstrap JavaScript code. See the [sass-loader](https://github.com/jtangelder/sass-loader) for
52 | instructions on configuring the directories.
53 | 4. Or you could use this loader and load a js file that configures Bootstrap.
54 |
55 | You can find an example of using this:
56 |
57 | [shakacode/bootstrap-sass-loader-example](https://github.com/shakacode/bootstrap-sass-loader-example)
58 |
59 | Note, `bootstrap-sass` must be installed locally inside of `../node_modules` or a parent directories `node_modules`
60 | directory relative to the loaded config file.
61 |
62 | Bootstrap Version
63 | ---
64 | The version of sass-bootstrap used is listed in peerDependencies, so you should be able to use whichever version you like.
65 |
66 | Simply specify that version of `bootstrap-sass` in your `package.json`, like this:
67 |
68 | "bootstrap-sass": "~3.3.1"
69 |
70 |
71 | Usage
72 | -----
73 |
74 | ### 1.a Complete Bootstrap
75 |
76 | To use the complete bootstrap package including styles and scripts with the default settings:
77 |
78 | ``` javascript
79 | require("bootstrap-sass-loader");
80 | ```
81 |
82 | The disadvantage to using this setup is that you can't:
83 |
84 | 1. Customize the bootstrap variables: [Bootstrap Customization](http://getbootstrap.com/customize/)
85 | 2. You can't use the bootstrap variables for your own sass stylesheets.
86 |
87 | ### 1.b Customized Bootstrap
88 |
89 | 1. Copy the file `bootstrap-sass.config.js` to your project. You will specify the file path in the `require` statement.
90 | 2. Open that file to customize the location of a file for any Bootstrap variable overrides (`preBootstrapCustomizations`
91 | and `bootstrapCustomizations`, and your main Sass file that can depend on Bootstrap variables, plus your customizations.
92 | Any of these 3 files are optional. You may also remove any Sass or Js modules that you don't need.
93 |
94 | Next, you should specify this as an entry point:
95 |
96 | ```
97 | module.exports = {
98 | entry: [
99 | "bootstrap-sass!./path/to/bootstrap-sass.config.js"
100 | ]
101 | ```
102 |
103 | Or a dependency within a file, like you'd specify other webpack dependencies:
104 |
105 | ```javascript
106 | require("bootstrap-sass!./path/to/bootstrap-sass.config.js");
107 | ```
108 |
109 |
110 | #### `bootstrap-sass.config.js`
111 |
112 | Here's a sample configuration file. The file included in the [bootstrap-sass-loader git repo](https://github.com/shakacode/bootstrap-sass-loader/blob/master/bootstrap-sass.config.js)
113 | has many more options. The two customization files, `bootstrapCustomizations`
114 | and `mainSass` are optional.
115 |
116 | ``` javascript
117 | module.exports = {
118 | bootstrapCustomizations: "./bootstrap-customizations.scss",
119 | mainSass: "./main.scss", // path to your main SASS file (optional)
120 | verbose: true, // print out your custom files used
121 | debug: false, // print out the full generated scss file
122 | styleLoader: "style-loader!css-loader!sass-loader", // see example for the ExtractTextPlugin
123 | scripts: {
124 | // add every bootstrap script you need
125 | 'transition': true
126 | },
127 | styles: {
128 | // add every bootstrap style you need
129 | "mixins": true,
130 |
131 | "normalize": true,
132 | "print": true,
133 |
134 | "scaffolding": true,
135 | "type": true,
136 | }
137 | };
138 | ```
139 |
140 | ### Font Configuration
141 | Bootstrap use some fonts. You need to configure the correct loaders in your `webpack.config.js`.
142 |
143 | Take a look at example https://github.com/shakacode/react-webpack-rails-tutorial which uses custom fonts with the
144 | bootstrap-sass-loader. You'll need to create define a font-face like this:
145 |
146 | ```scss
147 | @font-face {
148 | font-family: 'OpenSans-Light';
149 | src: url('assets/fonts/OpenSans-Light.ttf') format('truetype');
150 | }
151 | ```
152 |
153 | ### Example Loaders Configuration:
154 |
155 | ``` javascript
156 | module.exports = {
157 | module: {
158 | loaders: [
159 | // **IMPORTANT** This is needed so that each bootstrap js file required by
160 | // bootstrap-webpack has access to the jQuery object
161 | { test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' },
162 |
163 | // Needed for the css-loader when [bootstrap-webpack](https://github.com/bline/bootstrap-webpack)
164 | // loads bootstrap's css.
165 | { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
166 | { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
167 | { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
168 | { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
169 | { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }
170 | ]
171 | }
172 | };
173 | ```
174 |
175 | ## extract-text-plugin Notes
176 | * If you don't run webpack like this, you might get a very obscure error:
177 | ```
178 | PATH=$(npm bin):$PATH webpack --config webpack.rails.config.js
179 | ```
180 |
181 | Alternate, you can put $(npm bin) in your path. Basically if you run `type webpack` and the path is your global one, then
182 | you may have issues.
183 |
184 | * You can configure the output file of the created CSS file by using a relative path to the output directory. For example:
185 | ```
186 | plugins: [
187 | new ExtractTextPlugin("../stylesheets/bootstrap-and-customizations.css")
188 | ]
189 | ```
190 |
191 | ### Based on:
192 | * [bootstrap-webpack](https://github.com/bline/bootstrap-webpack).
193 | * DylanLukes/bootstrap-sass-webpack
194 |
195 | # Known Issues
196 | 1. Automatic Dependency loading is currently problematic. If you "touch" either of the customization files listed in
197 | your config file (bootstrapCustomizations, mainSass), then that will trigger a rebuild of the Sass files. This is a
198 | known issue with the sass-loader. I work around this issue by "touching" one of the 3 sass config files.
199 |
200 |
201 | Testing Changes in the Bootstrap Sass Loader
202 | =======================================================
203 | 1. See this article [Debugging NodeJs and Webpack Loaders](http://forum.railsonmaui.com/t/debugging-nodejs-and-webpack-loaders/142)
204 | 2. Clone both this project and https://github.com/shakacode/bootstrap-sass-loader-example
205 | 3. Use the npm link command per step #1 (see article)
206 | 4. Be sure to run `npm i bootstrap-sass` in the directory where you have the `bootstrap-sass-loader`. This is because
207 | the location of bootstap-sass is found relative to the `bootstrap-sass-loader` and if you linked it and it's not not
208 | there, then you'll bet this error: "Error: Could not find path to bootstrap-sass. Check to see that it's in a parent
209 | directory of config file containing node_modules/bootstrap-sass".
210 |
211 | Then in the bootstrap-sass-loader-example project:
212 |
213 | 1. Make some changes in the loader, put in some print statements maybe, then run `gulp webpack` to invoke the loader.
214 | 2. Then run `gulp build` and open the resulting file dist/index.html in the browser.
215 | 3. Run `gulp test` to confirm the changes work.
216 |
217 |
218 | Pull requests are welcome!
219 |
220 | For more info see: http://www.railsonmaui.com and http://forum.railsonmaui.com.
221 |
222 | Code Inspection and ESLint
223 | ======================================================
224 | 1. If using Webstorm import the inspection file in /jetbrains-inspection and inspect all files
225 | 2. Command line: `eslint .`
226 |
227 | Publishing to NPM
228 | ======================================================
229 | 1. Install the [release-it npm](https://github.com/webpro/release-it) program
230 | 2. Merge fixes to master
231 | 3. Run command `release-it`
232 | 4. Take defaults, except for last one to publish changes (answer Y)
233 |
--------------------------------------------------------------------------------
/bootstrap-sass-no-customizations.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | verbose: true,
3 | styleLoader: 'style-loader!css-loader!sass-loader',
4 |
5 | scripts: {
6 | 'transition': true,
7 | 'alert': true,
8 | 'button': true,
9 | 'carousel': true,
10 | 'collapse': true,
11 | 'dropdown': true,
12 | 'modal': true,
13 | 'tooltip': true,
14 | 'popover': true,
15 | 'scrollspy': true,
16 | 'tab': true,
17 | 'affix': true
18 | },
19 | styles: {
20 | 'mixins': true,
21 |
22 | 'normalize': true,
23 | 'print': true,
24 | 'glyphicons': true,
25 |
26 | 'scaffolding': true,
27 | 'type': true,
28 | 'code': true,
29 | 'grid': true,
30 | 'tables': true,
31 | 'forms': true,
32 | 'buttons': true,
33 |
34 | 'component-animations': true,
35 | 'dropdowns': true,
36 | 'button-groups': true,
37 | 'input-groups': true,
38 | 'navs': true,
39 | 'navbar': true,
40 | 'breadcrumbs': true,
41 | 'pagination': true,
42 | 'pager': true,
43 | 'labels': true,
44 | 'badges': true,
45 | 'jumbotron': true,
46 | 'thumbnails': true,
47 | 'alerts': true,
48 | 'progress-bars': true,
49 | 'media': true,
50 | 'list-group': true,
51 | 'panels': true,
52 | 'wells': true,
53 | 'responsive-embed': true,
54 | 'close': true,
55 |
56 | 'modals': true,
57 | 'tooltip': true,
58 | 'popovers': true,
59 | 'carousel': true,
60 |
61 | 'utilities': true,
62 | 'responsive-utilities': true
63 | }
64 | };
65 |
--------------------------------------------------------------------------------
/bootstrap-sass-scripts.loader.js:
--------------------------------------------------------------------------------
1 | var scripts = [
2 | 'transition',
3 | 'alert',
4 | 'button',
5 | 'carousel',
6 | 'collapse',
7 | 'dropdown',
8 | 'modal',
9 | 'tooltip',
10 | 'popover',
11 | 'scrollspy',
12 | 'tab',
13 | 'affix'
14 | ];
15 |
16 | var bootstrapSassPath = require('./bootstrapSassPath');
17 | var path = require('path');
18 |
19 | module.exports = function() {
20 | };
21 |
22 |
23 | // Create a list of require('path/to/bootstrap.js');
24 | module.exports.pitch = function(configPath) {
25 | var pathToBootstrapSass = bootstrapSassPath.getPath(this.context);
26 | var config = require(configPath);
27 | this.cacheable(true);
28 | return scripts.filter(function(script) {
29 | return config.scripts[script];
30 | }).map(function(script) {
31 | var pathToBootstrapJsFile = JSON.stringify(path.join(pathToBootstrapSass, 'javascripts',
32 | 'bootstrap', script));
33 | return 'require(' + pathToBootstrapJsFile + ');';
34 | }).join('\n');
35 | };
36 |
--------------------------------------------------------------------------------
/bootstrap-sass-styles.loader.js:
--------------------------------------------------------------------------------
1 | var partials = [
2 | 'mixins',
3 |
4 | 'normalize',
5 | 'print',
6 | 'glyphicons',
7 |
8 | 'scaffolding',
9 | 'type',
10 | 'code',
11 | 'grid',
12 | 'tables',
13 | 'forms',
14 | 'buttons',
15 |
16 | 'component-animations',
17 | 'dropdowns',
18 | 'button-groups',
19 | 'input-groups',
20 | 'navs',
21 | 'navbar',
22 | 'breadcrumbs',
23 | 'pagination',
24 | 'pager',
25 | 'labels',
26 | 'badges',
27 | 'jumbotron',
28 | 'thumbnails',
29 | 'alerts',
30 | 'progress-bars',
31 | 'media',
32 | 'list-group',
33 | 'panels',
34 | 'wells',
35 | 'responsive-embed',
36 | 'close',
37 |
38 | 'modals',
39 | 'tooltip',
40 | 'popovers',
41 | 'carousel',
42 |
43 | 'utilities',
44 | 'responsive-utilities'
45 | ];
46 | var path = require('path');
47 | var bootstrapSassPath = require('./bootstrapSassPath');
48 | var logger = require('./logger');
49 |
50 | function addImportReturnDependency(loader, config, propertyName) {
51 | var fileNameResolved;
52 | var fileName = config[propertyName];
53 | if (fileName && fileName.length > 0) {
54 | fileNameResolved = path.relative(loader.context, fileName);
55 |
56 | logger.verbose(config, 'fileName for %s: %s', propertyName, fileNameResolved);
57 | loader.addDependency(fileNameResolved);
58 | return '@import \'' + fileNameResolved + '\';\n';
59 | }
60 | }
61 |
62 | module.exports = function(content) {
63 | var source;
64 | var config = this.exec(content, this.resourcePath);
65 | var pathToBootstrapSass = bootstrapSassPath.getPath(this.context);
66 | var relativePathToBootstrapSass = path.relative(this.context, pathToBootstrapSass);
67 | var start = '';
68 | // This needs to be relative
69 | var iconFontPath = '$icon-font-path: \'' + path.join(relativePathToBootstrapSass, 'fonts/bootstrap/') + '\';';
70 | this.cacheable(true);
71 | logger.verbose(config, 'bootstrap-sass location: %s', relativePathToBootstrapSass);
72 | logger.verbose(config, 'Setting: %s', iconFontPath);
73 |
74 | if (config.preBootstrapCustomizations) {
75 | start += addImportReturnDependency(this, config, 'preBootstrapCustomizations');
76 | }
77 | start +=
78 | // Absolute paths as these are created at build time.
79 | '@import \'' + path.join(relativePathToBootstrapSass,
80 | 'stylesheets/bootstrap/variables') + '\';\n' + iconFontPath + '\n';
81 |
82 | if (config.bootstrapCustomizations) {
83 | start += addImportReturnDependency(this, config, 'bootstrapCustomizations');
84 | }
85 |
86 | source = start + partials.filter(function(partial) {
87 | return config.styles[partial];
88 | }).map(function(partial) {
89 | return '@import \'' + path.join(relativePathToBootstrapSass, 'stylesheets/bootstrap',
90 | partial) + '\';';
91 | }).join('\n');
92 |
93 | if (config.mainSass) {
94 | source += '\n' + addImportReturnDependency(this, config, 'mainSass');
95 | }
96 |
97 | source = source.replace(/\\/g, '/');
98 |
99 | logger.debug(config, 'Generated scss file is:\n' + source);
100 |
101 | return source;
102 | };
103 |
--------------------------------------------------------------------------------
/bootstrap-sass.config.js:
--------------------------------------------------------------------------------
1 | // Example file. Copy this to your project. Change then names of the referenced files or comment
2 | // them out. Convention is to name sass partials to start with an '_'
3 | module.exports = {
4 | verbose: true, // Set to true to show diagnostic information
5 |
6 | // IMPORTANT: Set next two configuration so you can customize
7 | // bootstrapCustomizations: gets loaded before bootstrap so you can configure the variables used
8 | // by bootstrap mainSass: gets loaded after bootstrap, so you can override a bootstrap style.
9 | // NOTE, these are optional.
10 |
11 | // Use preBootstrapCustomizations to change $brand-primary. Ensure this
12 | // preBootstrapCustomizations does not depend on other bootstrap variables.
13 | preBootstrapCustomizations: './_pre-bootstrap-customizations.scss',
14 |
15 | // Use bootstrapCustomizations to utilize other sass variables defined in
16 | // preBootstrapCustomizations or the _variables.scss file. This is useful to set one
17 | // customization value based on another value.
18 | bootstrapCustomizations: './_bootstrap-customizations.scss',
19 |
20 | mainSass: './_main.scss',
21 |
22 | // Default for the style loading
23 | styleLoader: 'style-loader!css-loader!sass-loader',
24 | //
25 | // If you want to use the ExtractTextPlugin
26 | // and you want compressed
27 | // styleLoader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader'),
28 | //
29 | // If you want expanded CSS
30 | // styleLoader: ExtractTextPlugin.extract('style-loader',
31 | // 'css-loader!sass?outputStyle=expanded'),
32 |
33 | scripts: {
34 | 'transition': true,
35 | 'alert': true,
36 | 'button': true,
37 | 'carousel': true,
38 | 'collapse': true,
39 | 'dropdown': true,
40 | 'modal': true,
41 | 'tooltip': true,
42 | 'popover': true,
43 | 'scrollspy': true,
44 | 'tab': true,
45 | 'affix': true
46 | },
47 | styles: {
48 | 'mixins': true,
49 |
50 | 'normalize': true,
51 | 'print': true,
52 | 'glyphicons': true,
53 |
54 | 'scaffolding': true,
55 | 'type': true,
56 | 'code': true,
57 | 'grid': true,
58 | 'tables': true,
59 | 'forms': true,
60 | 'buttons': true,
61 |
62 | 'component-animations': true,
63 | 'dropdowns': true,
64 | 'button-groups': true,
65 | 'input-groups': true,
66 | 'navs': true,
67 | 'navbar': true,
68 | 'breadcrumbs': true,
69 | 'pagination': true,
70 | 'pager': true,
71 | 'labels': true,
72 | 'badges': true,
73 | 'jumbotron': true,
74 | 'thumbnails': true,
75 | 'alerts': true,
76 | 'progress-bars': true,
77 | 'media': true,
78 | 'list-group': true,
79 | 'panels': true,
80 | 'wells': true,
81 | 'responsive-embed': true,
82 | 'close': true,
83 |
84 | 'modals': true,
85 | 'tooltip': true,
86 | 'popovers': true,
87 | 'carousel': true,
88 |
89 | 'utilities': true,
90 | 'responsive-utilities': true
91 | }
92 | };
93 |
94 |
--------------------------------------------------------------------------------
/bootstrapSassPath.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | var path = require('path');
3 |
4 | function bootstrapNotFound() {
5 | var msg = 'Could not find path to bootstrap-sass. Check to see that it is in a parent ' +
6 | 'directory of config file containing node_modules/bootstrap-sass';
7 | console.error('ERROR: ' + msg);
8 | throw new Error(msg);
9 | }
10 |
11 | function createTestParentPath(configPath, nLevelsUp) {
12 | var parentPath;
13 | var i;
14 | var levelsUp = configPath;
15 | for (i = 0; i < nLevelsUp; i++) {
16 | levelsUp += '/..';
17 | }
18 | parentPath = path.resolve(levelsUp);
19 | if (parentPath === '/') {
20 | bootstrapNotFound();
21 | }
22 |
23 | return path.resolve(path.join(levelsUp, 'node_modules', 'bootstrap-sass'));
24 | }
25 |
26 | module.exports = {
27 | getPath: function(configPath) {
28 | var bootstrapSassParentPath;
29 | var i = 0;
30 | do {
31 | bootstrapSassParentPath = createTestParentPath(configPath, i);
32 | i += 1;
33 | } while (!fs.existsSync(bootstrapSassParentPath) && i < 10);
34 |
35 | if (i === 10) {
36 | bootstrapNotFound();
37 | }
38 | return path.join(bootstrapSassParentPath, 'assets');
39 | }
40 | };
41 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | require('./bootstrap-sass-no-customizations.config');
2 |
--------------------------------------------------------------------------------
/index.loader.js:
--------------------------------------------------------------------------------
1 | var logger = require('./logger');
2 |
3 | module.exports = function() {
4 | };
5 |
6 | module.exports.pitch = function(remainingRequest) {
7 | var result;
8 | var jsLoaderCommand;
9 | var styleLoaderCommand;
10 | var styleLoader;
11 | var config;
12 | var msg;
13 |
14 | // Webpack 1.7.3 uses this.resourcePath. Leaving in remaining request for possibly older versions
15 | // of Webpack
16 | var configFilePath = this.resourcePath || remainingRequest;
17 | this.cacheable(true);
18 |
19 | if (!configFilePath || configFilePath.trim() === '') {
20 | msg = 'You specified the bootstrap-sass-loader with no configuration file. Please specify' +
21 | ' the configuration file, like: \'bootstrap-sass!./bootstrap-sass.config.js\' or use' +
22 | ' require(\'bootstrap-sass-loader\').';
23 | console.error('ERROR: ' + msg);
24 | throw new Error(msg);
25 | }
26 |
27 | config = require(configFilePath);
28 | styleLoader = config.styleLoader || 'style-loader!css-loader!sass-loader';
29 | logger.verbose(config, 'styleLoader: %s', styleLoader);
30 |
31 | styleLoaderCommand = 'require(' + JSON.stringify('-!' + styleLoader + '!' +
32 | require.resolve('./bootstrap-sass-styles.loader.js') + '!' + configFilePath) + ');';
33 | jsLoaderCommand = 'require(' + JSON.stringify('-!' +
34 | require.resolve('./bootstrap-sass-scripts.loader.js') + '!' + configFilePath) + ');';
35 | result = [styleLoaderCommand, jsLoaderCommand].join('\n');
36 | return result;
37 | };
38 |
--------------------------------------------------------------------------------
/jetbrains-inspection/Inspection_RailsOnMaui_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/logger.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | log: function() {
3 | var msg = arguments[1];
4 | var args = Array.prototype.slice.call(arguments);
5 | var a = ['[bootstrap-sass-loader]: ' + msg];
6 | a = a.concat(args.slice(2));
7 | console.log.apply(null, a);
8 | },
9 | /**
10 | * Print verbose level message.
11 | * @param {object} config Configuration object
12 | * @param {string} msg Message to display, can contain %O, %s, etc.
13 | * @returns {void}
14 | * Add additional arguments as needed for formatting of msg
15 | */
16 | verbose: function(config, msg) {
17 | if (config.verbose) {
18 | this.log.apply(this, arguments);
19 | }
20 | },
21 | /**
22 | * Print debug level message.
23 | * @param {object} config Configuration object
24 | * @param {string} msg Message to display, can contain %O, %s, etc.
25 | * @returns {void}
26 | * Add additional arguments as needed for formatting of msg
27 | */
28 | debug: function(config, msg) {
29 | if (config.debug) {
30 | this.log.apply(this, arguments);
31 | }
32 | }
33 | };
34 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap-sass-loader",
3 | "description": "bootstrap-sass package for webpack",
4 | "main": "index.js",
5 | "version": "1.0.10",
6 | "loader": "index.loader.js",
7 | "keywords": [
8 | "bootstrap",
9 | "webpack",
10 | "sass"
11 | ],
12 | "author": {
13 | "name": "Justin Gordon "
14 | },
15 | "bugs": {
16 | "url": "https://github.com/shakacode/bootstrap-sass-loader/issues"
17 | },
18 | "dependencies": {},
19 | "license": "MIT",
20 | "repository": {
21 | "type": "git",
22 | "url": "https://github.com/shakacode/bootstrap-sass-loader.git"
23 | },
24 | "peerDependencies": {
25 | "bootstrap-sass": "*",
26 | "css-loader": "*",
27 | "sass-loader": "*",
28 | "style-loader": "*",
29 | "url-loader": "*",
30 | "file-loader": "*"
31 | },
32 | "scripts": {
33 | "test": "echo 'Please see README.md for test instructions'; exit 1;"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------