Skip to content

Commit de97ebe

Browse files
committed
first commit
0 parents  commit de97ebe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+7310
-0
lines changed

.babelrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
["es2015", { "modules": false }],
4+
"stage-2"
5+
],
6+
"comments": false,
7+
"env": {
8+
"test": {
9+
"plugins": [ "istanbul" ]
10+
}
11+
}
12+
}

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/*.js
2+
config/*.js
3+
**/*.spec.js

.eslintrc.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// http://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
sourceType: 'module'
8+
},
9+
env: {
10+
browser: true,
11+
},
12+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
13+
extends: 'standard',
14+
// required to lint *.vue files
15+
plugins: [
16+
'html'
17+
],
18+
// add your custom rules here
19+
'rules': {
20+
// allow paren-less arrow functions
21+
'arrow-parens': 0,
22+
// allow async-await
23+
'generator-star-spacing': 0,
24+
// allow debugger during development
25+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
26+
}
27+
}

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log
5+
test/unit/coverage
6+
test/e2e/reports
7+
selenium-debug.log
8+
.idea

README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# vue-bulma-components
2+
The goal of this library is to use the bulma class syntax as components and props.
3+
4+
## Usage
5+
Exemple with grid system
6+
7+
Original Bulma way:
8+
9+
``` html
10+
<div class="columns is-mobile">
11+
<div class="column is-half is-offset-one-quarter">
12+
A column
13+
</div>
14+
</div>
15+
```
16+
17+
Vue-bulma-component way:
18+
```html
19+
<columns is-mobile>
20+
<column is-half is-offset-one-quarter>
21+
A column
22+
</column>
23+
</columns>
24+
```
25+
26+
## Install
27+
28+
```shell
29+
yarn add vue-bulma-components
30+
31+
or
32+
33+
npm install --save vue-bulma-components
34+
```
35+
36+
Inside your main.js
37+
38+
```javascript
39+
import vueBulmaComponents from 'vue-bulma-components'
40+
Vue.use(vueBulmaComponents)
41+
```
42+
43+
You can also prefix all the bulma components ( to avoid collision with existing components)
44+
45+
```javascript
46+
import vueBulmaComponents from 'vue-bulma-components'
47+
Vue.use(vueBulmaComponents,{prefix:'b-'})
48+
```
49+
50+
Instead of using `<columns/>` you need to use `<b-columns/>`
51+
52+
## Advanced
53+
```html
54+
<button is-primary> Hello </button>
55+
```
56+
57+
Actually renders as :
58+
```
59+
<div class="button is-primary"> Hello </div>
60+
```
61+
62+
To render a button element instead of a div, use the prop `outerElement`
63+
```html
64+
<button outerElement="button" is-primary> Hello </button>
65+
```
66+
67+
68+

build/build.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// https://github.com/shelljs/shelljs
2+
require('./check-versions')()
3+
4+
process.env.NODE_ENV = 'production'
5+
6+
var ora = require('ora')
7+
var path = require('path')
8+
var chalk = require('chalk')
9+
var shell = require('shelljs')
10+
var webpack = require('webpack')
11+
var config = require('../config')
12+
var webpackConfig = require('./webpack.prod.conf')
13+
14+
var spinner = ora('building for production...')
15+
spinner.start()
16+
17+
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
18+
shell.rm('-rf', assetsPath)
19+
shell.mkdir('-p', assetsPath)
20+
shell.config.silent = true
21+
shell.cp('-R', 'static/*', assetsPath)
22+
shell.config.silent = false
23+
24+
webpack(webpackConfig, function (err, stats) {
25+
spinner.stop()
26+
if (err) throw err
27+
process.stdout.write(stats.toString({
28+
colors: true,
29+
modules: false,
30+
children: false,
31+
chunks: false,
32+
chunkModules: false
33+
}) + '\n\n')
34+
35+
console.log(chalk.cyan(' Build complete.\n'))
36+
console.log(chalk.yellow(
37+
' Tip: built files are meant to be served over an HTTP server.\n' +
38+
' Opening index.html over file:// won\'t work.\n'
39+
))
40+
})

build/check-versions.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
var chalk = require('chalk')
2+
var semver = require('semver')
3+
var packageConfig = require('../package.json')
4+
5+
function exec (cmd) {
6+
return require('child_process').execSync(cmd).toString().trim()
7+
}
8+
9+
var versionRequirements = [
10+
{
11+
name: 'node',
12+
currentVersion: semver.clean(process.version),
13+
versionRequirement: packageConfig.engines.node
14+
},
15+
{
16+
name: 'npm',
17+
currentVersion: exec('npm --version'),
18+
versionRequirement: packageConfig.engines.npm
19+
}
20+
]
21+
22+
module.exports = function () {
23+
var warnings = []
24+
for (var i = 0; i < versionRequirements.length; i++) {
25+
var mod = versionRequirements[i]
26+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
27+
warnings.push(mod.name + ': ' +
28+
chalk.red(mod.currentVersion) + ' should be ' +
29+
chalk.green(mod.versionRequirement)
30+
)
31+
}
32+
}
33+
34+
if (warnings.length) {
35+
console.log('')
36+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
37+
console.log()
38+
for (var i = 0; i < warnings.length; i++) {
39+
var warning = warnings[i]
40+
console.log(' ' + warning)
41+
}
42+
console.log()
43+
process.exit(1)
44+
}
45+
}

build/dev-client.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
require('eventsource-polyfill')
3+
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4+
5+
hotClient.subscribe(function (event) {
6+
if (event.action === 'reload') {
7+
window.location.reload()
8+
}
9+
})

build/dev-server.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
require('./check-versions')()
2+
3+
var config = require('../config')
4+
if (!process.env.NODE_ENV) {
5+
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6+
}
7+
8+
var opn = require('opn')
9+
var path = require('path')
10+
var express = require('express')
11+
var webpack = require('webpack')
12+
var proxyMiddleware = require('http-proxy-middleware')
13+
var webpackConfig = process.env.NODE_ENV === 'testing'
14+
? require('./webpack.prod.conf')
15+
: require('./webpack.dev.conf')
16+
17+
// default port where dev server listens for incoming traffic
18+
var port = process.env.PORT || config.dev.port
19+
// automatically open browser, if not set will be false
20+
var autoOpenBrowser = !!config.dev.autoOpenBrowser
21+
// Define HTTP proxies to your custom API backend
22+
// https://github.com/chimurai/http-proxy-middleware
23+
var proxyTable = config.dev.proxyTable
24+
25+
var app = express()
26+
var compiler = webpack(webpackConfig)
27+
28+
var devMiddleware = require('webpack-dev-middleware')(compiler, {
29+
publicPath: webpackConfig.output.publicPath,
30+
quiet: true
31+
})
32+
33+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
34+
log: () => {}
35+
})
36+
// force page reload when html-webpack-plugin template changes
37+
compiler.plugin('compilation', function (compilation) {
38+
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
39+
hotMiddleware.publish({ action: 'reload' })
40+
cb()
41+
})
42+
})
43+
44+
// proxy api requests
45+
Object.keys(proxyTable).forEach(function (context) {
46+
var options = proxyTable[context]
47+
if (typeof options === 'string') {
48+
options = { target: options }
49+
}
50+
app.use(proxyMiddleware(options.filter || context, options))
51+
})
52+
53+
// handle fallback for HTML5 history API
54+
app.use(require('connect-history-api-fallback')())
55+
56+
// serve webpack bundle output
57+
app.use(devMiddleware)
58+
59+
// enable hot-reload and state-preserving
60+
// compilation error display
61+
app.use(hotMiddleware)
62+
63+
// serve pure static assets
64+
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
65+
app.use(staticPath, express.static('./static'))
66+
67+
var uri = 'http://localhost:' + port
68+
69+
devMiddleware.waitUntilValid(function () {
70+
console.log('> Listening at ' + uri + '\n')
71+
})
72+
73+
module.exports = app.listen(port, function (err) {
74+
if (err) {
75+
console.log(err)
76+
return
77+
}
78+
79+
// when env is testing, don't need open it
80+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
81+
opn(uri)
82+
}
83+
})

build/utils.js

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
var path = require('path')
2+
var config = require('../config')
3+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
4+
5+
exports.assetsPath = function (_path) {
6+
var assetsSubDirectory = process.env.NODE_ENV === 'production'
7+
? config.build.assetsSubDirectory
8+
: config.dev.assetsSubDirectory
9+
return path.posix.join(assetsSubDirectory, _path)
10+
}
11+
12+
exports.cssLoaders = function (options) {
13+
options = options || {}
14+
// generate loader string to be used with extract text plugin
15+
function generateLoaders (loaders) {
16+
var sourceLoader = loaders.map(function (loader) {
17+
var extraParamChar
18+
if (/\?/.test(loader)) {
19+
loader = loader.replace(/\?/, '-loader?')
20+
extraParamChar = '&'
21+
} else {
22+
loader = loader + '-loader'
23+
extraParamChar = '?'
24+
}
25+
return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
26+
}).join('!')
27+
28+
// Extract CSS when that option is specified
29+
// (which is the case during production build)
30+
if (options.extract) {
31+
return ExtractTextPlugin.extract({
32+
use: sourceLoader,
33+
fallback: 'vue-style-loader'
34+
})
35+
} else {
36+
return ['vue-style-loader', sourceLoader].join('!')
37+
}
38+
}
39+
40+
// http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
41+
return {
42+
css: generateLoaders(['css']),
43+
postcss: generateLoaders(['css']),
44+
less: generateLoaders(['css', 'less']),
45+
sass: generateLoaders(['css', 'sass?indentedSyntax']),
46+
scss: generateLoaders(['css', 'sass']),
47+
stylus: generateLoaders(['css', 'stylus']),
48+
styl: generateLoaders(['css', 'stylus'])
49+
}
50+
}
51+
52+
// Generate loaders for standalone style files (outside of .vue)
53+
exports.styleLoaders = function (options) {
54+
var output = []
55+
var loaders = exports.cssLoaders(options)
56+
for (var extension in loaders) {
57+
var loader = loaders[extension]
58+
output.push({
59+
test: new RegExp('\\.' + extension + '$'),
60+
loader: loader
61+
})
62+
}
63+
return output
64+
}

build/vue-loader.conf.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var utils = require('./utils')
2+
var config = require('../config')
3+
var isProduction = process.env.NODE_ENV === 'production'
4+
5+
module.exports = {
6+
loaders: utils.cssLoaders({
7+
sourceMap: isProduction
8+
? config.build.productionSourceMap
9+
: config.dev.cssSourceMap,
10+
extract: isProduction
11+
}),
12+
postcss: [
13+
require('autoprefixer')({
14+
browsers: ['last 2 versions']
15+
})
16+
]
17+
}

0 commit comments

Comments
 (0)