Skip to content

Commit

Permalink
init...
Browse files Browse the repository at this point in the history
  • Loading branch information
s4l1h committed Feb 10, 2016
0 parents commit 4fd0270
Show file tree
Hide file tree
Showing 22 changed files with 689 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.DS_Store
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
docs
bower.json
14 changes: 14 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "vue-toastr",
"main": "dist/vue-toastr.js",
"description": "Toastr for Vue.js",
"version": "1.0.0",
"homepage": "https://github.com/s4l1h/vue-toastr",
"license": "MIT",
"ignore": [
".*",
"build",
"docs",
"package.json"
]
}
48 changes: 48 additions & 0 deletions build/webpack.config.combine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
var vue = require('vue-loader')
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
name: 'vueToastr',
output: {
path: './dist',
publicPath: '/dist/',
filename: 'vue-toastr.js',
library: ["vueToastr"],
libraryTarget: "umd"
},
module: {
loaders: [{
test: /\.less$/,
loader: "style!css!less",
}, {
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.html$/,
loader: "vue-html"
}, {
test: /\.js$/,
exclude: /node_modules|\/dist/,
loader: 'babel'
}]
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'lodash', 'add-module-exports']
}
}
module.exports.output.filename = module.exports.output.filename.replace(/\.js$/, '.combine.min.js');
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
50 changes: 50 additions & 0 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
var vue = require('vue-loader')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
name: 'vueToastr',
output: {
path: './dist',
publicPath: '/dist/',
filename: 'vue-toastr.js',
library: ["vueToastr"],
libraryTarget: "umd"
},
module: {
loaders: [{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
}, {
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.html$/,
loader: "vue-html"
}, {
test: /\.js$/,
exclude: /node_modules|\/dist/,
loader: 'babel'
}]
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'lodash', 'add-module-exports']
}
}
module.exports.plugins = [
new ExtractTextPlugin(module.exports.output.filename.replace(/\.js$/, '.css')),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap:true,
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
module.exports.devtool = '#source-map'
50 changes: 50 additions & 0 deletions build/webpack.config.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
var vue = require('vue-loader')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
name: 'vueToastr',
output: {
path: './dist',
publicPath: '/dist/',
filename: 'vue-toastr.js',
library: ["vueToastr"],
libraryTarget: "umd"
},
module: {
loaders: [{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
}, {
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.html$/,
loader: "vue-html"
}, {
test: /\.js$/,
exclude: /node_modules|\/dist/,
loader: 'babel'
}]
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime', 'lodash', 'add-module-exports']
}
}
module.exports.output.filename = module.exports.output.filename.replace(/\.js$/, '.min.js');
module.exports.plugins = [
new ExtractTextPlugin(module.exports.output.filename.replace(/\.js$/, '.css')),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
52 changes: 52 additions & 0 deletions demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
new Vue({
el: '#app',
data: function data() {
return {};
},
components: {
'vue-toastr': window.vueToastr
},
methods: {
add: function() {
//console.log(this.$refs.toastr);
// if you send String default setting working.
this.$refs.toastr.Add("Working With Default Options,closed 5 sec.");
// Add another Toast
var VooAaa = this.$refs.toastr.Add({
title: 'Hi Click And See : ', // + (Math.random() * 10).toString(),
msg: '<p id="test">AA</p><br>This timeout 5 sec.. but manuel closed 2 sec.', // + (Math.random() * 10).toString(),
type: 'warning',
position: 'toast-top-left',
timeout: 5000,
clickClose: false,
onClosed: function() {
alert("onClosed");
},
onCreated: function() {
// get from test id from toast component.
// if component not created you cant access this.
alert("onCreated " + document.getElementById("test").innerHTML);
},
onClicked: function() {
alert("onClicked");
}
});
//console.log(VooAaa);
// You can close manuel this.
setTimeout(function() {
this.$refs.toastr.Close(VooAaa);
}.bind(this), 2000);
//this.$refs.toastr.close(VooAaa);


// You Can Change Default Toast Type
this.$refs.toastr.defaultTimeout = 3000; // default timeout : 5000
// You Can Change Default Toast Type
this.$refs.toastr.defaultType = "error"; // default type : success
// You Can Change Default Position
this.$refs.toastr.defaultPosition = "toast-bottom-left" // default position: toast-top-right
this.$refs.toastr.Add("Default Type Position and timeout is Changed, closed 3 sec.");
}
}
});
1 change: 1 addition & 0 deletions dist/vue-toastr.combine.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/vue-toastr.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/vue-toastr.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4fd0270

Please sign in to comment.